I am having trouble with the <bean:define> tag, specifically the toScope
parameter.

Here is the situation:

I set up some collections in an action class to use as <select> options in a
form and set them as attributes on the request object. These collections
contain information pulled from a database, customized for different sets of
users. Everything works perfectly unless there is a problem with validation
in the associated user form. In that case, the collection "beans" go out of
scope and and the jsp call results in an exception saying that the
collection bean cannot be found in the request scope. Here is some example
code to hopefully make everything a bit clearer.

In the action class:

...
Collection industrySectorList =
optionGenerator.getIndustrySectorList(connection, userID);
request.setAttribute("industrySectortList", industrySectorList);
...

In the jsp:
...
<bean:define id="industrySectorList" name="industrySectorList"
scope="request" toScope="request" type="java.util.Collection"/>
...
<html:select value="applicantForm" property="industrySectorID" >
        <html:options collection="industrySectorList" property="value"
labelProperty="label"/>
</html:select>
...

If I understand correctly, when user form validation fails, the associated
action is bypassed and the request is forwarded back to the originating jsp
page. How can I make sure that the collection beans necessary to display
option lists stay in scope so that I don't get an exception? Why doesn't the
toScope parameter in the <bean:define> tag work in this case? Thanks,

Rob

By the way, the exact exception that I get is:
javax.servlet.jsp.JspException: Cannot find bean industrySectorList in scope
request


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to