For the first question; I would recommend using LabelValueBean

<html:select property="socId" >
  <html:optionsCollection property="dropDownValues"/>
</html:select>

You should have a method "getDropDownValues" which returns a
"Collection" of LabelValueBeans.



On Sat, 8 Jan 2005 18:27:01 -0800 (PST), meena r <[EMAIL PROTECTED]> wrote:
> I am facing issues while the my jsp has to be
> pre-popluated with form data in case of from
> validation errors.
> 
> The issues are :
> 
> 1.  Usage of <html:option>
> 
> I have a requirement where in the value in the
> <html:option> is a dynamically generated value where I
> tried to do the following
> 
> <html:select property="socId" >
> <logic:iterate id ="pricingDO" name="priceFsamilyDO"
> property="dropDownValues">
>        <html:option value="<bean:write name="pricingDO"
> property="price"> "><bean:write name="pricingDO"
> property="displayprice"></html:option>
> </logic:iterate>
> 
> </html:option>
> 
> I got an error messge during jsp compilation
> "Attribute pricingDO has no value"
> 
> Someone in my team siad that the value tag in
> html:option cannot be generated dynamically.So I
> changed the code as follows  where I used the ordinary
> option tag
> 
> <html:select property="socId" >
> <logic:iterate id ="pricingDO" name="priceFsamilyDO"
> property="dropDownValues">
>        <option value="<bean:write name="pricingDO"
> property="price"> "><bean:write name="pricingDO"
> property="displayprice"></option>
> </logic:iterate>
> 
> </html:option>
> 
> But the problem am facing using the ordinary option
> tag  instead of <html:option> is that
> during error validation failures where the jsp should
> be pre-populated with the user selected value , it
> doesn't happen so and t the option drop down doens't
> get pre-selected with the user selected value.
> 
> Any idea whether I am using the tag incorrectly or
> whether anything else is missing.
> 
> 2.  Usage of indexed properties .
> 
> I have the same issue of pre-population of indexed
> properties in case of error validation i.e I have
> something like
> 
> <logic: iterate....... indexId="someIndex>
> 
> <html:text name="subscriber[<bean:write
> name="someIndex"> value="" maxlenght="40"/>
>

You are explicitly setting the value=""; and so you wouldn't see the
value in the form. For more info
http://struts.apache.org/faqs/indexedprops.html
 
> </logic;iterate>
> 
> The form bean has the following getter/setter methods;
> 
> public String getSubscriber(int index)
> {
>        return (String)subList.get(index);
> }
> 
> public void setSubscriber(string sub,int index)
> 
> {
>        subList.add(sub,index);
> }
> 
> The values are getting set in the form whereas in both
> the cases mentioned above pre-population of the page
> whith user enetered values fails .
> 
> Thanks
> Meena
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - now with 250MB free storage. Learn more.
> http://info.mail.yahoo.com/mail_250
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

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

Reply via email to