日期:2014-05-20 浏览次数:21069 次
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { // TODO Auto-generated method stub ActionErrors errors=new ActionErrors(); if((userName==null)||(userName=="")||(userName.length()==0)){ errors.add("userName",new ActionMessage("userInfo.userNameEmpty")); } if((userPassword==null)||(userPassword=="")||(userPassword.length()==0)){ errors.add("userPassword",new ActionMessage("userInfo.userPasswordEmpty")); } return errors; }
# Resources for parameter 'cn.edu.zjut.struts.ApplicationResources' # Project LMS userInfo.userNameEmpty=please input userName! userInfo.userPasswordEmpty=please input userPassword!
<td colspan="3" background="images/login_29.png"><html:errors />
        </td>
<form-beans >
       <form-bean name="userForm" type="cn.edu.zjut.ActionFrom.userForm" />
     </form-beans>
     <action
      attribute="userForm"
      input="/admin/login.jsp"
      name="userForm"
      path="/userLogin"
      scope="request"
      type="cn.edu.zjut.Action.UserLoginAction">
      <set-property property="cancellable" value="true" />
      <forward name="loginSuccess" path="manageIndex" />
      <forward name="loginFailure" path="/admin/loginFailure.html" />
    </action>