This week's book giveaway is in the Open Source Projects forum.
We're giving away four copies of Eclipse Collections Categorically: Level up your programming game and have Donald Raab on-line!
See this thread for details.
  • 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
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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
 
You learn how to close your eyes and tell yourself "this just isn't really happening to me." Tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic