You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by jm...@metlife.com on 2005/10/07 20:36:51 UTC

Problem displaying available choices in Select option list when Validator send me back to my input page

Using Struts 1.1

Problem:
Problem displaying available choices in Select option list when using
Validator sends me back to my input page.

Details:
I have 2 html select dropdown boxes on my web page. The values that appear
inside come from my database, and are sent to my form inside my form bean.
On the initial JSP rendering my page displays fine. My problem occurs when
the page doesn't pass a struts validation rule, and formbean is sent back
to my input page. My formbean property that was holding my List of objects
is now null, and  I need to redisplay the list of available choices back on
my page.


struts html that I am using

<html:select name="UserProfileForm" property="select1" styleClass=
"standardText" multiple="true">
      <html:optionsCollection name="UserProfileForm"
            property="unSubscribedGroupDisplay"
            value="grpId"
            label="grpDesc" />
</html:select>

Note:
UserProfileForm.getUnSubscribedGroupDisplay() returns a List of Objects,
and these objects have a set/getGrpId and set/getGrpDesc



The information contained in this message may be CONFIDENTIAL and is for the intended addressee only.  Any unauthorized use, dissemination of the information, or copying of this message is prohibited.  If you are not the intended addressee, please notify the sender immediately and delete this message.

Re: Problem displaying available choices in Select option list when Validator send me back to my input page

Posted by Laurie Harper <la...@holoweb.net>.
jmazzella@metlife.com wrote:
> Using Struts 1.1
> 
> Problem:
> Problem displaying available choices in Select option list when using
> Validator sends me back to my input page.
> 
> Details:
> I have 2 html select dropdown boxes on my web page. The values that appear
> inside come from my database, and are sent to my form inside my form bean.
> On the initial JSP rendering my page displays fine. My problem occurs when
> the page doesn't pass a struts validation rule, and formbean is sent back
> to my input page. My formbean property that was holding my List of objects
> is now null, and  I need to redisplay the list of available choices back on
> my page.
> 
> 
> struts html that I am using
> 
> <html:select name="UserProfileForm" property="select1" styleClass=
> "standardText" multiple="true">
>       <html:optionsCollection name="UserProfileForm"
>             property="unSubscribedGroupDisplay"
>             value="grpId"
>             label="grpDesc" />
> </html:select>
> 
> Note:
> UserProfileForm.getUnSubscribedGroupDisplay() returns a List of Objects,
> and these objects have a set/getGrpId and set/getGrpDesc

How is UserProfileForm instantiated and initialized? What do your action 
mappings and form bean definitions look like? Without more information 
it's impossible to say definitively what's wrong.

The most likely explanation is that you are returning control directly 
to a JSP when validation fails rather than to the action that sets up 
the form bean. If you have an action that runs and then forwards to the 
JSP the first time it's shown, you need to name that action in the 
'input' for the action that's executed on form submission, rather than 
the JSP itself.

If that doesn't make sense, post the rest of your configuration and 
code, or at least describe how you have everything configured.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org