html:errors 错误

html:errors 错误:添加错误: public ActionErrors validate(ActionMapping mapping, HttpServletRequest re

html:errors 错误:

添加错误:
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
// TODO Auto-generated method stub
ActionErrors ae=new ActionErrors();
if(name.length() <4||name.length()>20||pw.length() <4||pw.length()>8){
ae.add("length error", new ActionMessage("com.length.error"));
}
if(!name.equals("scott")){
ae.add("user rror", new ActionMessage("com.user.error"));
}
if(ae.size()==0)
return null;
else
return ae;
}
显示错误为什么用 <html:errors/>
无法输出。
用 <html:messages id="error">
  <span id="error"> <bean:write name="error" /> </span> <br>
</html:messages>
可以输出错误,
资源配置文件为:
com.length.error=length error
com.user.error=user error

------解决方法--------------------------------------------------------
<bean:write property="这里应该和Form里面的ae.add("user rror", new ActionMessage("com.user.error")); " 之中的'user rror是一样的'/>
------解决方法--------------------------------------------------------
ae.add("length error", new ActionMessage("com.length.error")); 
改成ae.add("length error", new ActionError("com.length.error"));