我参考网上的例子写了一个STRUTS框架的小程序,我的程序可以运行但是TOMCAT报 ERROR CREATING FORM BEAN OF CLASS 我写的FORMBEAN,请问是什么问题
这是我的STRUTS-CONFIG。XML
<struts-config>
<form-beans >
<form-bean name="LoginForm" type="com.yourcompany.struts.form.LoginForm" />
</form-beans> <global-exceptions />
<global-forwards />
<action-mappings >
<action path="/logincheck" type="com.yourcompany.struts.action.LoginAction" name="LoginForm" scope="request">
<forward name="success" path="/welcome.jsp"/>
<forward name="failed" path="/failed.jsp"/>
</action>
</action-mappings>
<message-resources parameter="com.yourcompany.struts.ApplicationResources" />
</struts-config>
这是我的STRUTS-CONFIG。XML
<struts-config>
<form-beans >
<form-bean name="LoginForm" type="com.yourcompany.struts.form.LoginForm" />
</form-beans> <global-exceptions />
<global-forwards />
<action-mappings >
<action path="/logincheck" type="com.yourcompany.struts.action.LoginAction" name="LoginForm" scope="request">
<forward name="success" path="/welcome.jsp"/>
<forward name="failed" path="/failed.jsp"/>
</action>
</action-mappings>
<message-resources parameter="com.yourcompany.struts.ApplicationResources" />
</struts-config>
解决方案 »
- struts2 类型转换失败
- 关于数据库连接池,两个应用访问同一个数据库出现问题!!!!!!!!!!!!!!!!
- 最新整理的300多个编程设计网站,论坛,有兴趣的朋友可以看看。
- 求axis 整合sping jdbc的demo
- 关于使用javabean时取到组件的值的问题
- 请问这是怎么回事?望知道的高人指点!
- 关于tomcat
- Response 出错!!------------------在线等待
- 大家都是如何加密自己的B/S系统的,,都来说说~~
- 讨论在JSP中传递参数的方法,(在线等候,高分相送):) :) ;)
- 请教大家一个关于servlet的问题~!
- 求教:在几台电脑组成的局域网中同步一个网站内文件的解决办法
看看path有没有问题
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws IOException {
LoginForm log=null;
String username=request.getParameter("username");
String password=request.getParameter("password");
PrintWriter out=response.getWriter();
out.print(username);
out.println(password);
System.out.print("a");
String encoding = request.getCharacterEncoding();
if ((encoding != null) && (encoding.equalsIgnoreCase("GB2312"))) {
response.setContentType("text/html; charset=GB2312");
}else{
response.setContentType("text/html; charset=GBK");
}
System.out.print("b");
try {
// if (form instanceof LoginForm) {
// LoginForm theForm = (LoginForm) form;
// if(theForm.getUsername().equals("user") &&
// theForm.getPassword().equals("123456")) {
// //return new ActionForward("/welcome.do?type=true");
// //response.sendRedirect("/success?type=true");
// return mapping.findForward("success");
// }
//
// else{
// return mapping.findForward("failed");
// //return new ActionForward("/welcome.do?type=false");
// //response.sendRedirect("/success?type=false");
// }
// }
// Message m=new Message(username,password);
Message m=new Message(username,password);
log=m.getLoginForm();
if(log==null||log.equals(""))
{
return mapping.findForward("failed");
}
else
{
return mapping.findForward("success");
}
} catch (Exception e) {
}
System.out.print("c");
// this shouldn't happen in this example
return null;
}
log=m.getLoginForm();"看看是不是这的问题
String username=request.getParameter("username");<br/>
String password=request.getParameter("password");<br/>
既然用struts,为什么不有FormBean来封装这些参数<br/>
免费招聘、求职。IT人工作的天堂。希望能够为大家所用。
try {
System.out.print("c");
LoginForm theForm = null;
System.out.print(theForm.getUsername());
System.out.print(theForm.getPassword());
Message m=new Message(theForm.getUsername(),theForm.getPassword());
theForm=m.getLoginForm();
System.out.print(theForm.getUsername());
System.out.print(theForm.getPassword());
System.out.print("d");
if(theForm==null||theForm.equals("") ) {
//return new ActionForward("/welcome.do?type=true");
//response.sendRedirect("/success?type=true");
return mapping.findForward("success");
}
else{
return mapping.findForward("failed");
//return new ActionForward("/welcome.do?type=false");
//response.sendRedirect("/success?type=false");
}
} catch (Exception e) {
}
return null;}
还是有问题,各位高手帮我看看该怎么改???????