环境为struts 1.1
register.jsp如下:
<%@ page contentType="text/html;charset=gb2312" %>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<%@ taglib uri="/struts-logic" prefix="logic" %>
<%@ taglib uri="/struts-bean" prefix="bean" %>
<%@ taglib uri="/struts-html" prefix="html" %>
<html:html locale="true">
<html:base/>
<body>
<br>
<html:form action="/register">
姓名:<html:text property="name"/><br>
<html:errors/><br>
        I  D:<html:text property="id"/><br>
sex :<html:text property="sex"/><br>
email:<html:text property="email"/>
pwd :<html:text property="pwd"/>
        <html:submit value="REGIDTER"/>
</html:form>
</body>
</html:html>ApplicationResources.properties文件如下:
#-- error messages --name is null or aa=name is null or aaformbean如下:
//进行有效的判断,这里简化了判断
public ActionErrors validate(ActionMapping mapping,HttpServletRequest request)
{
ActionErrors errors=new ActionErrors();
if ( (userinfo.getName()==null) || (userinfo.getName().equals("aa")) || userinfo.getName().length()<3 )
  //if (true)
{
errors.add("name",new ActionError("name is null or aa"));
}
return errors;
}
}struts-config.xml相关配置如下:
  <action path="/register" 
         type="com.linda.UserAction"
                 name="userForm" 
                 scope="request"
                 validate="true"
                 input="/register.jsp">          
         </action>说明:
上述配置后,我在姓名框里输入aa后,页面还会调转到本身页面,但是不提示错误--name is null or aa .这是为什么呢?