日期:2014-05-18  浏览次数:20684 次

stucts问题
我要写一个用户登陆界面,如下:
<%@   page   contentType= "text/html;charset=gbk "%>

<%@   taglib   uri= "struts/html "   prefix= "html "   %>
<center> <h1> 用户登陆 </h1> </center>

<table   align= "center "   cellspaing= "1 "   border= "1 ">
<tr>
<html:form   action= "/bookLogin "   enctype= "multipart/form-data ">
name: <html:text   property= "username "/> <br>
password: <html:password   property= "password "/> <br>
<html:submit> 提交 </html:submit>
</html:form>
</tr>
</table>
structs-config.xml   中这么写:
        <action   path= "/bookLogin "   scope= "session "   parameter= "login "   type= "com.ts.BookAction "   name= "loginForm "   validate= "false ">
        <forward   name= "success "   path= "/bookList.do "   redirect= "true "/>
        </action>
Action中对应写的:
else   if( "login ".equals(act)){
HttpSession   session   =   request.getSession();
LoginForm   lf   =   new   LoginForm();
LoginVO   logall=new   LoginVO();
System.out.println(act);
if(bb.getLogin(lf.getUsername())!=null)
{

logall   =   bb.getLogin(lf.getUsername());

if(logall.getPassword().equals(lf.getPassword()))
{
System.out.println( "sdfsdfsdf ");
try{
session.setAttribute( "logall ",logall);
}catch(Exception   e){
e.printStackTrace();
}
}
else
{
try{
  response.sendRedirect( "errorl.jsp ");
}catch(Exception   e){
e.printStackTrace();
}
}

之后有如下错误:
javax.servlet.ServletException:   Cannot   retrieve   definition   for   form   bean   loginForm   on   action   /bookLogin
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
org.apache.jsp.loginForm_jsp._jspService(loginForm_jsp.java:84)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

请指教这是什么意思!

------解决方案--------------------
<action path= "/bookLogin " scope= "session " parameter= "login " type= "com.ts.BookAction " name= "loginForm " validate= "false ">
中的loginForm是否和 <form-bean〉中的name属性一样
------解决方案--------------------
LZ配置 FORMBEAN了没有。认真检查name属性要相同 类路径要正确
------解决方案--------------------
没有找到 <fo