This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes How convert into struts html select  clause Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How convert into struts html select  clause" Watch "How convert into struts html select  clause" New topic
Author

How convert into struts html select clause

Vilas Lawande
Ranch Hand

Joined: Nov 07, 2006
Posts: 127
<select id="groupName" name="groupName" class="dropDownBlack_22text" >
<jsp:scriptlet>
java.util.List groups = (java.util.List) session.getAttribute("groups");
java.util.Iterator itr = groups.iterator();
while (itr.hasNext())
{
DemoBean group = (DemoBean) itr.next();
</jsp:scriptlet>
<option id="nameOfSelectedGroup" value="<jsp:expression>group.getName()</jsp:expression>"> <jsp:expression>group.getName()</jsp:expression></option>
<jsp:scriptlet>
}
</jsp:scriptlet>
</select>
Siddharth Naik
Ranch Hand

Joined: Apr 09, 2006
Posts: 35
html select tag has all attributes you have used in the code above. Please refer to Taglib Doc.

http://struts.apache.org/1.x/struts-taglib/tlddoc/index.html

You will also find an example in this discussion:

http://www.coderanch.com/t/59022/Struts/decreasing-width-drop-down-box


Thanks<br />Sid
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How convert into struts html select clause
 
Similar Threads
how in JSP I translate an html checkbox to true/false in java
jsp:text question
Xml equivalents
How to retain drop-down list value after submit?
How to write jsp with xml syntax