wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts and JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts and JSP" Watch "Struts and JSP" New topic
Author

Struts and JSP

janice ang
Greenhorn

Joined: Jan 03, 2007
Posts: 5
Hi all,

I would like to know how can i display my bean:write value together with the existing value in the drop down menu in a way that there will be no repetition in my values?

<html:form action="UpdatePersonalDetails" onsubmit="return validatePersonalDetailsFormBean(this)">

<logic:iterate id="Student" name="studentList">

<select name="randomAssignTeam">
<option value="<bean:write name='Student' property='randomAssignTeam'/>" key="selected"><bean:write name='Student' property='randomAssignTeam'/></option> <option value="No">No</option>
<option value="Yes">Yes</option> </select>

For example, my bean:write value is Yes. With the above codes, the drop down will show Yes, No, Yes instead of only Yes, No
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

Please be sure to post Struts questions in the Struts forum. I have moved this post there for you.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Nacho Espinosa
Ranch Hand

Joined: Jan 17, 2007
Posts: 30
Hi janice:

This is your code:

<logic:iterate id="Student" name="studentList">

<select name="randomAssignTeam">
<option value="<bean:write name='Student' property='randomAssignTeam'/>" key="selected"><bean:write name='Student' property='randomAssignTeam'/></option> <option value="No">No</option>
<option value="Yes">Yes</option> </select>

I notice that the iterate tag is out of select, then when iterate works, draw many times your select tag, and other tags.

Maybe you should use the optionCollection tag.

Or to do the next:

<logic:iterate id="Student" name="studentList">

<select name="randomAssignTeam">
<logic:iterate id="Student" name="studentList">
<option value="<bean:write name='Student' property='randomAssignTeam'/>" key="selected"><bean:write name='Student' property='randomAssignTeam'/></option>
</logic:iterate>
<option value="No">No</option>
<option value="Yes">Yes</option> </select>

But I suggest the first option.



Bye


Greetings<br />Nacho Espinosa<br />SCJP 1.4
 
Don't get me started about those stupid light bulbs.
 
subject: Struts and JSP
 
Similar Threads
Strut-Ajax - display states when Country selected
html:select inside logic:iterate
Logic iterate
Access a dynamic array of HTML elements in JavaScipt
taglibs problem