| Author |
html:form and ForwardAction
|
Matt Connors
Greenhorn
Joined: Sep 08, 2004
Posts: 23
|
|
In my .jsp I have: <html:form action="Welcome"> ... The corresponding ActionMapping in my struts-config file is as follows: <action path="/Welcome" type="org.apache.struts.actions.ForwardAction" roles="employee" parameter="page.welcome"/> When I run the .jsp I get the following error: javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:831) It appears that Struts does not allow me to use an ActionForward as the target of the <html:form action= ...>. I believe I am receiving the error because the action mapping "<action path="/Welcome" ...." does not have an ActionForm associated with it. Is it possible to use an ActionForward as the target of an <html:form ...> statement? Is there an easy way around this? I don't want to change the ActionForward to a full-fledged ActionMapping because it's Action class and its ActionForm would not do anything functionally. Any suggestions would be appreciated. Thanks, Matt
|
 |
John Smith
Ranch Hand
Joined: Sep 02, 2004
Posts: 61
|
|
I don't know that you're supposed to do things that way. You could possibly use that and pass the page parameter as on the url with a javascript location forward? eg. Failing that maybe logic:redirect would be of some use? Hope this helps!
|
 |
sreenath reddy
Ranch Hand
Joined: Sep 21, 2003
Posts: 415
|
|
Hi matt I am not able to understand the reason why u r going for <html:form> with out havig a formbean attached to it and that too the strange thing is that u r using the default ForwarAction ......this forweardatcion will be used when u want a link to be tranferred to jsp and then u should not violate MVC and that too the primatry reason why u r getting that exception is <html:form> will always look for formbean attched to it to render the name attribute of ur form which is missing in urs
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: html:form and ForwardAction
|
|
|