| Author |
Populating an HTML option list from a resultset
|
Kevin Currie
Greenhorn
Joined: Feb 02, 2004
Posts: 2
|
|
Hi, Anyone know how to populate an HTML form option list from a JDBC resultset? Thanks in advance.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56192
|
|
Here's my version of the 2,679 ways this could be done: (in other words, here's how I'd do it): 1) The controller servlet for the request would interact with a model-level class that abstracts the list. Returned would be an array list or other structure containing the name-value pairs for the options list. The JDBC is completely performed in the model class. 2) The controller would place this list on the request as an attribute, then forward to the JSP page for the view. 3) The JSP page would use the JSTL forEach tag to iterate over the list and construct the HTML for the options. Notice that each tier of the MVC architecural patterm comes into play. [ February 16, 2004: Message edited by: Bear Bibeault ]
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
steve souza
Ranch Hand
Joined: Jun 26, 2002
Posts: 852
|
|
One of several FormattedDataSet signatures available. Others take ResultSet's and display multiselect, and regular listboxes.
|
http://www.jamonapi.com/ - a fast, free open source performance tuning api.
JavaRanch Performance FAQ
|
 |
 |
|
|
subject: Populating an HTML option list from a resultset
|
|
|