• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Using logic:iterate in select box

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi

i have a multiselect box and i want to set the values and the options using <logic:iterate>...the following is my code

<html:select name="ReqBean" multiple="true" property="scopeAllChoices">
<logic:iterate id="Req" name="ReqBean" property="arrScope">
<html ption value="<bean:write name='Req'Property='scopeID'/>">
<bean:write name="Req" property="scopeDesc"/>
</html ption>
</logic:iterate>
</html:select>

here ReqBean is the form bean and arrScope is the arraylist containing two items namely scopeID and scopeDesc...
when i run this code i get the value as <bean:write..> tag itself...please suggest me a solution.
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try to use expression language as following :

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This code might solve your problem.

<html:select property="scopeAllChoices" name="ReqBean" multiple="true">
<logic resent name="ReqBean" property = "eligGrpMemIdList">
<html ption value="-1" >
<bean:message key="txtAll"/></html ption>
<html ptions name="ReqBean" property = "scopeID" labelName="ReqBean" labelProperty = "scopeDesc"></html ptions>
</logic resent>
</html:select>

Where
scopeAllChoices must be a String[] which holds the selected list of values.
scopeID must be an arraylist containing id's
scopeDesc must be an arraylist containing desc
 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This would be a nice way to do it if you want to make it truly dynamic.


In your action


In jsp:


But i think the previous reply may work
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic