• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

help please

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is there a way in struts wherein i can have a combo dropdown list without having a javascript?? i mean can i do it in pure struts tags?? if so can anybody help me with this please...
[ September 04, 2006: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi my_aro,

From whatever I could understand i think this should help you out.

<html:select property="location" styleClass="textfield">
<html ption value="India"/>
<html ption value="Australia"/>
<html ption value="Japan"/>

<% for (i =0;i<location.size();i++){ %>
<html ption value="<%=location.get(i).toString()%>">
<%=location.get(i).toString()%>
</html ption>
<%} %>
</html:select>

You may either use the hard coded values like in options 1,2,3 or you may fetch from a database and put into a collection(location) and then iterate it on the JSP.
Hope it helps!
 
RoshaniG Gopal
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by RoshaniG Gopal:

<% for (i =0;i<location.size();i++){ %>
<html ption value="<%=location.get(i).toString()%>">
<%=location.get(i).toString()%>
</html ption>
<%} %>
</html:select>



Please read as : location as locationList (for the collection that has to be iterated)

<% for (i =0;i<locationList.size();i++){ %>
<html ption value="<%=locationList.get(i).toString()%>">
<%=locationList.get(i).toString()%>
</html ption>
<%} %>
</html:select>

Thanks
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by RoshaniG Gopal:

<% for (i =0;i<locationList.size();i++){ %>
<html:option value="<%=locationList.get(i).toString()%>">
<%=locationList.get(i).toString()%>
</html:option>
<%} %>
</html:select>



While the above example will work, it's much simpler to write:

 
Agapetos Herodotos
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
tahnks..
 
reply
    Bookmark Topic Watch Topic
  • New Topic