Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP! Cannot find ActionForm in any scope

Status
Not open for further replies.

pbuidev

Programmer
Jan 9, 2004
2
US
I am a newbie to struts. My jsp is mostly displaying read-only data to the user. I am populating this data from ActionForm attributes. I don't understand why my display items have to be in an html:form with an action. I do understand that if I have buttons or other input items that they must be in an html:form. If I do not put the items in an html:form, then I get the error javax.servlet.jsp.JspException: Cannot find bean xxx in any scope.

Please help in my understanding of this issue. Or is this some kind of setup issue?


Thanks
 
This is because form bean is created at <html:form> tag. Thus if you try to access the form bean before <html:form>, the form bean is not yet available. If you really need to put the data in the form bean, then you can place the <html:form> tag at the very begining of the HTML code, e.g. right after <body> tag.

Alternatively, you can put those non form field data into request attribute in the Action class (i.e. request.setAttribute(&quot;name&quot;, value)), and display them using the <bean:write name=&quot;name&quot; property=&quot;&quot;/>...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top