Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Struts and the fly likes How to populate values inside a dropdown box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to populate values inside a dropdown box" Watch "How to populate values inside a dropdown box" New topic
Author

How to populate values inside a dropdown box

Adarsh Raj
Greenhorn

Joined: Mar 18, 2009
Posts: 5
I'm a beginner in struts. i want to know how to populate values inside a dropdown box(<html:select>).

I've already created the necessary action forms, action and model classes. I can retrieve values from the database and also i can see that the values present inside the form's action form. But i don't know how to show these values from the action form to a jsp page.

I'm using struts tag in jsp/view components. My code is like this

ActionForm


Jsp code


Adz
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

I'm not very good at struts 1.x, so I can point you to what I think should be the solution. Try to use the html:optionsCollection tag inside the html:select tag...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Siva Masilamani
Ranch Hand

Joined: Sep 19, 2008
Posts: 385
You can try this


SCJP 6,SCWCD 5,SCBCD 5

Failure is not an option.
Adarsh Raj
Greenhorn

Joined: Mar 18, 2009
Posts: 5
Thanks Siva. That helped
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to populate values inside a dropdown box
 
Similar Threads
Help Determining Why App is No Longer Working
Struts 1.x : stuck with html:select
populate dropdown with database values
Issue in Struts Dropdown(Need Help Ranchers)
selecting a value in drop down box