Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Struts
Search Coderanch
Advance search
Google search
Register / Login
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
Forum:
Struts
How to use html:select ?
Ritu Kapoor
Ranch Hand
Posts: 102
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
Can anyone pls tell me using an example how to use html:select tag to populate drop-down dynamically. The values may come from ArrayList or List.
Please help.
Rgds,
Ritu
vishnu vardhana reddy vaka
Greenhorn
Posts: 9
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
in
Jsp
:
<html:select name="createFormBean" property="salesForce"> <html :-o ption value="">Make a Selection</html :-o ption> <html :-o ptionsCollection name="createForm" property="selctComboBox" value="OptionId" label="OptionValue" /> </html:select> create Form bean with on collection which can hold entire Select Box public class CreateForm extends ActionForm { private ArrayList selctComboBox = null; //setters getters for the above } //Create A utility Class which can represent one Option Pair in the Select Box public class CreateComboOption { private String OptionId = null; private String OptionValue = null; //getters setters for the above }
in action class class just do the following
execute method (....) { ArrayList CoboBoxList = new ArrayList(); CreateComboOption OptionObj; for (int i = 0; i < 10; i++) { OptionObj= new CreateComboOption(); OptionObj.setOptionId(i); OptionObj.setOptionId("dispaly Name"+i); CoboBoxList.add(OptionObj); } formbean.setSelctComboBox(CoboBoxList); ... } //end of execute method
add each option pair as one CreateComboOption object
like
Vishnu Vardahna Reddy.Vaka
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
html:select
How to Populate ArrayList
using c:out in a href and html:select
Logic iterate problem
How can I used html:select with a Collection of String
More...