| 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: 56202
|
|
|
Please be sure to post Struts questions in the Struts forum. I have moved this post there for you.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About 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
|
 |
 |
|
|
subject: Struts and JSP
|
|
|