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 Struts and JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply 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: 56202
    
  13

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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Struts and JSP
 
Similar Threads
Strut-Ajax - display states when Country selected
html:select inside logic:iterate
taglibs problem
Logic iterate
Access a dynamic array of HTML elements in JavaScipt