struts中有验证的方法..在那里边写..

解决方案 »

  1.   

    1、在structs的actionForm的validate方法里写
    2、界面用传统的,但是action指向userRegister.do我喜欢第二种,这样可以利用javascript的强大。
      

  2.   

    看看Struts中关于验证的使用吧
    要在要在Struts-config.xml文件中配置Validate.xml
      

  3.   

    <html:javascript formName="yourForm"/>
      

  4.   

    用了
    function checkRegForm() {
             if (document.all['username'].value == "") {
                 alert("<bean:message key="SA.userReg.usernameAlert"/>");
                 return false;
                }
               .............
               .............
    表单也不用加  name="...."   搞定了的