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 JSP and the fly likes Passing SELECT Options 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 » Java » JSP
Bookmark "Passing SELECT Options" Watch "Passing SELECT Options" New topic
Author

Passing SELECT Options

DK Taylor
Greenhorn

Joined: Mar 17, 2005
Posts: 22
I am refactoring my JSP module. I have a field with the OPTION values hard-coded, and now I have a class that gets the keys/values from a table, so I can keep the screen and report in sync.
How do I send the options list to the JSP?
I'm not using Struts or anything fancy (except WSAD).

Thanks


Thanks,<br />Dana
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60765
    
  65

Your question is very vague with regards to what aspect of this has you blocked.

The way I generally do this:

1) The servlet controller for page cooperates with a model class to obtain the key/value pairs.
2) This info gets placed into a request-scoped variable for passing to the page.
3) On-page, JSTL/EL is used to construct the <select> and <option> elements.

Because order is important, the data structure I use is usually a List of Map.Entry elements.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
DK Taylor
Greenhorn

Joined: Mar 17, 2005
Posts: 22
Thanks, Bear,

I think the JSTL/EL is the part I wasn't thinking of. I haven't used it that much.
I have an ArrayList of Properties that I can "send". I'll see what I can do with that.

So much to think about!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing SELECT Options
 
Similar Threads
clearing HTML form fields after return from struts validation with errors
Question on Select boxes
Populating a dependant select list without reloading the page
Accesing the property file from jsp
Struts 2 Select Tag