Computing.Net > Forums > Web Development > jsp drop down boxes

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

jsp drop down boxes

Reply to Message Icon

Name: liliyaw
Date: April 11, 2006 at 11:46:44 Pacific
OS: linux
CPU/Ram: 524
Product: don't know
Comment:

Hello everyone,
I have a rather long list of select options, and I also have a mysql table that contains that very same data. I'd like to be able to streamline the data from the table into my select menu.
I know enough of .jsp to read data from a table but not don't know enough to do something like this, and I know there is a way of doing this in .jsp. Could anyone please refer me to any code examples so I could see what needs to happen? Thanks in advance.



Sponsored Link
Ads by Google

Response Number 1
Name: Michael J (by mjdamato)
Date: April 11, 2006 at 12:43:38 Pacific
Reply:

What do you mean by "I'd like to be able to streamline the data from the table into my select menu."

If you mean you just want to create the select list from all of the options in the table then you would do something like this (assuming rs = record set result and the option name/value is the first item in each record.):

<select name="selectname">
<% while(rs.next()) {
opt = rs.getString(1); %>
<option value="<%=opt%>"><%=opt%></option>
<% } %>
</select>


Michael J


0

Response Number 2
Name: liliyaw
Date: April 11, 2006 at 13:41:25 Pacific
Reply:

Thanks Michael,
I can view my .jsp file with no errors, but my select box is empty at this point... Just got to debug it now.



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: jsp drop down boxes

Drop Down Box www.computing.net/answers/webdevel/drop-down-box/2882.html

javascript drop down box www.computing.net/answers/webdevel/javascript-drop-down-box/1437.html

Cookie to remember drop down box www.computing.net/answers/webdevel/cookie-to-remember-drop-down-box-/4229.html