javascript 文本框输入值为空判断
//校验名称和日期不为空
function checksave(){
var sname=document.getElementById("sname").value;
var stime=document.getElementById("datetimepicker1").value;
var etime=document.getElementById("datetimepicker2").value;
if(sname=="" )
{
alert("名字不能为空!") ;
return false;
}
if ((stime=="") || (etime=="") ){
alert("开始或结束时间不能为空!") ;
return false;
}
}java中字符串比较  equals
if ("".equals(product.getName()) ){
            
            if(product.getSmallClassId()== -9999){
                
                 specialVos= specialService.getSpecialVos(special.getId());
                
            }else{
                
                specialVos= specialService.getSpecialVos(special.getId(),product.getSmallClassId());
                
            }
        }非string类型
    if (special.getId()==null){
                special.setId(idGenerator.incr(Special.class));
                special.setCreateDate(new Date());
                special.setCreateUser((long) 110);
                specialService.saveSpecial(special);    
            }
struct中
后台string类型的值 若前台输入框未填写留空,则后台得到的是空字符串"",判断时用equals
后台非string类型的值 若前台输入框未填写留空,则后台的得到的是null,判断时用== 
本文出自 “一无所有-天行者” 博客,请务必保留此出处http://tianxingzhe.blog.51cto.com/3390077/1677646
原文:http://tianxingzhe.blog.51cto.com/3390077/1677646