I'm guessing that your form bean has request scope. In this case, a new bean
will be created by Struts on the next request. That bean won't have your
list of network types, which would explain what you are seeing.

You could try putting your form bean in session scope instead. This means
that it will still be around, with the network types intact, the next time a
request comes in. To do this, add 'scope="session"' to the relevant action
mapping in your struts-config.xml file.

You should also make sure that the form bean's reset() method doesn't clear
out the network types.

Hope this helps.

--
Martin Cooper


----- Original Message -----
From: "Young, Wayne" <[EMAIL PROTECTED]>
To: "Struts-Dev@Jakarta. Apache. Org (E-mail)"
<[EMAIL PROTECTED]>
Sent: Thursday, March 29, 2001 10:55 AM
Subject: dropdown values gone after validation error


> I have the following struts/JSP fragment that creates a dropdown with
values
> from the networkTypes attribute.
>
> <html:select styleClass="Field" property="networkType" size="1">
>   <html:options property="networkTypes"/>
> </html:select></td>
>
> The networkTypes attribute is created in the "getNetworkTypes" action that
> displays this page. The page displays correctly initially. But if I have a
> validation error & the page reloads, the networkTypes variable is empty &
I
> end up with an empty dropdown.
>
> Any ideas on how to keep from losing the values in my dropdown after a
> validation error? Is there any way to re-invoke the "getNetworkTypes"
action
> from the Validate() method on my ActionForm descendant? (Maybe forward to
> the "getNetworkTypes" action & return null in Validate?)
>
> Any help would be appreciated.
>
> Thanks.
>
> Wayne
> [EMAIL PROTECTED]


Reply via email to