为什么总是提示出错?
1.jsp页面如下:
<%@ page language="java"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
<html>
<head>
<title>JSP for loginForm form</title>
</head>
<body>
<html:form action="/login">
userName : <html:text property="userName"/><html:errors property="userNameIsNull"></html:errors>
<html:submit/><html:cancel/>
</html:form>
</body>
</html>
2.loginForm.java的validate如下:
public ActionErrors validate(
ActionMapping mapping,
HttpServletRequest request) {
// TODO Auto-generated method stub
ActionErrors errors = new ActionErrors();
if(this.userName.equalsIgnoreCase( "zjg"))
errors.add("userNameIsNull",new ActionMessage("error.login.userNameNull"));
return errors;
}
为什么当我在文本框中输入:zjg后,系统总是提示含有<html:errors>标签的行出错,删除以后就不报错,出错信息如下:
org.apache.jasper.JasperException: Exception in JSP: /form/login.jsp:12
9: </head>
10: <body>
11: <html:form action="/login">
12: userName : <html:text property="userName"/><html:errors property="userNameIsNull"></html:errors>
13: <html:submit/><html:cancel/>
14: </html:form>
15: </body>