File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes html:select with options Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Application Frameworks » Struts
Reply Bookmark "html:select with options" Watch "html:select with options" New topic
Author

html:select with options

Nicolas Flammel
Ranch Hand

Joined: May 05, 2004
Posts: 32
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 ]
 
 
subject: html:select with options
 
Threads others viewed
Pass selected bean property to javascript
Combo box
storing values chosen from dropdown
update html:options
set html:option to defalut bean value
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture