aspose file tools*
The moose likes Struts and the fly likes ForwardAction error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "ForwardAction error" Watch "ForwardAction error" New topic
Author

ForwardAction error

aresh babu
Ranch Hand

Joined: Aug 31, 2008
Posts: 65
When i am trying to forward from home.jsp
<html:link page="/employerlogin.do">Employer Login</html:link>


struts-config.xml
<action path="/employerlogin"
parameter="/employerlogin.jsp"
type="org.apache.struts.actions.ForwardAction" />



employerlogin.jsp page
<html:center>
<pre>
Login Page
<html:form action="employerlogin" method="post">
UserName:<html:text property="username" />


Password:<html:password property="password" />
<html:submit>Login</html:submit>
</html:form>

I am trying to forward the employerlogin.jsp from home.jsp as mentioned above
But i am getting these exceptions.

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null on action employerlogin
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null on action employerlogin
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:852)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
org.apache.jsp.employerlogin_jsp._jspService(employerlogin_jsp.java:89)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null on action employerlogin
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:767)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:443)
org.apache.jsp.employerlogin_jsp._jspx_meth_html_005fform_005f0(employerlogin_jsp.java:487)
org.apache.jsp.employerlogin_jsp._jspx_meth_html_005fhtml_005f0(employerlogin_jsp.java:210)
org.apache.jsp.employerlogin_jsp._jspService(employerlogin_jsp.java:80)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

How can i overcome these exceptions and how can i forward the employerlogin.jsp from home.jsp?


Please help me

Regards,
Areshbabu
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You're using a form tag but have no form configured for the page--you need a form for pages with form tags.

(I think; it's been awhile since I've used Struts 1 :)
aresh babu
Ranch Hand

Joined: Aug 31, 2008
Posts: 65
Hello David,

Do you mean i have to write a form bean class for home.jsp?

If it needs please tell me how can i write a form bean for taking multiple requests.

I need to call employerlogin.jsp and graduatelogin.jsp from home.jsp . How can i write the form bean class for home.jsp?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

The "home" action doesn't need a form bean if there's no form. Pages with form tags need form beans.
rk palleru
Greenhorn

Joined: Feb 26, 2009
Posts: 22
you try to forward jsp page with <html:link href="*.jsp ">
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

rk palleru wrote:you try to forward jsp page with <html:link href="*.jsp ">


for what ? if he has the only jsp again. he will face the same error right. As newton mentioned earlier try to create ActionForm for the page(action after submitting the form) else use <form> instead of <html:form>[but it is not good idea ]
rk palleru
Greenhorn

Joined: Feb 26, 2009
Posts: 22
here login.jsp is one link in home.jsp
so you call <html:link href="login.jsp"> login </html:link> in home.jsp
then no need of action mapping tag for that login page because you just calling href(hyperlink) in home.jsp
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

@rk: You're addressing a problem that doesn't exist: the pages *with forms* need ActionForms. Also, linking directly to JSP pages is generally frowned upon; it's better to normalize all page accesses to be actions.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ForwardAction error