在submint里这样写:
function check(){
  if((document.name.value==null)||(document.name.value.trim()=="")){
     alert("弹出一个对话框提示他没有输入");
     return true;
  }----不全只是个mod-----呵呵

解决方案 »

  1.   

    <script>
    function checkUserId(){
        if (forms[0].name.value == null || forms[0].name.value == "") {
            alert("当没有输入帐号的时候弹出一个对话框提示他没有输入");
        } 
    }
    </script><html:form onsubmit="checkUserId()">
    帐号:<html:text property="name"/>
    密码:<html:password property="password"/>
    </html:form>
      

  2.   

    使用validation插件更方便,为什么不用呢?
    具体可看structs自带的文档
      

  3.   

    public ActionErrors validate(ActionMapping actionMapping,
                                   HttpServletRequest httpServletRequest){
    中校验
    }