Struts TAG 问题如何解决??

zhaoxuefeng zhaoxuefeng 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
出现错误:
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>
...全文
评论
收藏 已收藏
分享
返回顶部
zhaoxuefeng
Java EE 67,535 成员 225,843 内容