Initially I tried to do the same i.e placing the List1 in the form. But for some reason the options were not displaying.

I am using DynaValidatorForm and form-bean is defined in the struts config.

In my prepare action I have
LabelValueBean lblValueBean1 = new LabelValueBean("Visa", "V");
LabelValueBean lblValueBean2 = new LabelValueBean("MasterCard", "M"); LabelValueBean lblValueBean3 = new LabelValueBean("American Express", "AE");

       //Options
       ArrayList List1 = new ArrayList();
       List1 .add(lblValueBean1);
       List1 .add(lblValueBean2);
       List1 .add(lblValueBean3);

       request.set("List1 ", List1 );

> The Jsp the combox is filled
> ...........
> ..........
> <html:select name="FacilityForm" property="selected">
>                             <html:options collection="List1"
> property="value" labelProperty="label"/>
>                         </html:select>

can you tell me how to define the collection in the form-bean so that it can be accessed by the JSP? As I tried this before and was not successful.

Thanks.


From: Michael Jouravlev <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <user@struts.apache.org>
To: Struts Users Mailing List <user@struts.apache.org>
Subject: Re: cannot find bean error, when cliked on submit button
Date: Tue, 17 Jan 2006 13:20:42 -0800

> In the JSP have comboboxes.
>
> PrepareFacilityAction
>
> .....
> ....
> request.setAttribute("List1", getList1(form));
> ...........
> ...........
>
> The Jsp the combox is filled
> ...........
> ..........
> <html:select name="FacilityForm" property="selected">
>                             <html:options collection="List1"
> property="value" labelProperty="label"/>
>                         </html:select>
>
> ..............
> ................
>
>
>
> The JSP displayes fine with all the values in it. This JSP has required
> fields in it. Used validator.xml to define al lthe required fields.
>
> There is a Save Button which is the submit button in the JSP. When clicked
> on Save want the validations to be done and be in the same JSP.
>
> When Clicked on Save, it is not going into the DispatchFacilityAction
>
> But getting the error in JSP
> Cannot find bean under name List1 ------ This List1 was in the request when
> the JSP originally displayed.
>
> Why is this?

Maybe because Struts tries to set current selection in the List1
object, which has request scope and is already gone. Not sure about it
though, I need to look into how Struts sets selected item for
list-type property.

> How to fix this.

I would not create any objects outside ActionForm like you did with
List1. Instead, I would define all objects that are needed to be
displayed/updated as properties of ActionForm. This approach will keep
all page-related objects in one place, and they all will be available
at once.

Michael.

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


_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfee® Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


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

Reply via email to