Struts TAG 问题如何解决??
出现错误:
javax.servlet.ServletException: No getter method for property UserName of bean org.apache.struts.taglib.html.BEAN
下面是原文件
getter method = getUserName() 方法,
请帮我在看一下哪一个文件出问题了
package struts;
import org.apache.struts.action.*;
import javax.servlet.http.*;
public class Userform extends Actionform {
private String UserName;
private String passwd;
public Userform(){}
public void setUserName(String me) {
UserName = me;
}
public String getUserName() {
return UserName;
}
public void setPasswd(String passwd) {
this.passwd = passwd;
}
public String getPasswd() {
return passwd;
}
}
ACTION 文件
package struts;
import struts.Userform;
public final class LoginAction
extends Action {
public ActionForward execute(ActionMapping mapping, Actionform form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
HttpSession session = request.getSession();
Userform um = (Userform) form;
if ("boy".equals(um.getUserName()))
return (mapping.findForward("failed"));
else
return (mapping.findForward("regist"));
}
}
JSP 文件
<%@ page contentType="text/html; charset=GBK" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:html>
<head>
<title>
test
</title>
</head>
<body>
<h1>JBuilder Generated Struts JSP for Actionform struts.Userform</h1>
<p>
<html:form action="/loginAction.do" method="POST">
<html:text property="UserName"/>
<br>
<html:text property="passwd"/>
<br>
<html:submit property="submit" value="Submit"/><br>
<html:reset value ="Reset"/>
</html:form>
</body>
</html:html>