The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

Struts drop down

HI!

I am working on struts1.2,i want to develop registration form in my appln,
In my screen,I have country drop down box and state drop down box,the country values i need to get it from
database and display on jsp screen,

I dn't want to use sql query tag to execute query in jsp,how to display in other way the country drop down?..

Re: Struts drop down

In your Action class, instantiate a dao class which has a method that returns an ArrayList of LabelValueBean (look at api) of value='value of dropdown' and label='label of dropdown' and place the ArrayList of LabelValueBean into you session attribute.

In your jsp, use <html:select> and <htmlptions> tag. In <htmlptions> tag, attribute property='value', labelProperty='label' and collections='name of session attribute'