struts html:errors问题
index.jsp
------------------------------------------------------
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/WEB-INF/struts-html" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic" prefix="logic"%>
<html:html>
<head>
<html:base/>
<title>Logon</title>
</head>
<body>
<html:errors />
<html:form action="/logon.do" focus="username">
<table border="1">
<tr>
<td>UserName:</td>
<td><html:text property="username" size="12" maxlength="10" /></td>
</tr>
<tr>
<td>Password:</td>
<td><html:password property="password" size="12" maxlength="10"/></td>
</tr>
<tr>
<td></td>
<td>
<html:submit>submit</html:submit>
<html:reset>reset</html:reset>
</td>
</tr>
</table>
</html:form>
</body>
</html:html>
LogonForm
---------------------------------------------------------------
public ActionErrors validate(ActionMapping map,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if ((username == null) || (username.length() < 1))
errors.add("username", new ActionMessage("error.logon.no.username"));
if ((password == null) || (password.length() < 1))
errors.add("password", new ActionMessage("error.logon.no.password"));
return errors;
}
_______________________________________________________________
当输入为空验证出错误以后返回index.jsp,这个时候出现异常
struts-config.xml
____________________________________________________________
<form-beans>
<form-bean name="LogonForm" type="app.form.LogonForm" />
</form-beans>
<global-exceptions />
<global-forwards>
<forward name="logonSuccess" path="/welcome.jsp" />
</global-forwards>
<action-mappings>
<action path="/logon" type="app.action.LogonAction"
name="LogonForm" scope="request" validate="true" input="/error.jsp" />
</action-mappings>
<controller />