• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

html:select with options

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is getting complex for me...

My form action class has a List of HasHMaps containing key/value pairs of result from the database. The key is the table column name and the value is the value for that column. The is one key/value pair that has multiple values(like the column being choice which has comma separated values like yes,no or accept,decline,ok...)

I am using logic:iterate tag like:-
<logic:iterate id='rows' name='LIST_NAME'> (LIST_NAME exists in the request)
to display the rows with the values from the list of HashMaps. I want to display the choices not as a comma separated string but want to parse the choices and insert the values(yes,no) into a drop-down box.
I have used
<html:select name='formName' property='selectedValue'>
<html ptions
collection='LIST_NAME'
property='rowId'
labelProperty='choices'/>
</html:select>
But I am getting the choices related to all the rows like comma separated values. Guess its not taking for that particulat row. How do I go about doing this. Any help would be appreciated.
---------------------------------------------------------------------------
Wow I got it.
But leaving it here for other members. Maybe helpful...
Well I inserted this code inside my logic:iterate........
<html:select name='formName' property='selectedValue'>
<%
String choiceVal = replyChoiceValue.toString();
StringTokenizer st = new StringTokenizer(replyChoiceVal,",");
while(st.hasMoreTokens()){
String value = st.nextToken();
System.out.println("Value= " + value);
%>
<html ption value="<%=value%>"><%=value%></html ption>
<%}%>
</html:select>

Well just wondering if I can get rid of the scriptlets... :roll:
[ May 28, 2004: Message edited by: Nicolas Flammel ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic