Struts TAG 问题如何解决??

zhaoxuefeng 2004-03-17 11:09:40
出现错误:
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>
...全文
18 点赞 收藏 回复
写回复
回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复

还没有回复,快来抢沙发~

发帖
Java EE
创建于2007-09-28

6.6w+

社区成员

J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
申请成为版主
帖子事件
创建了帖子
2004-03-17 11:09
社区公告
暂无公告