jsp drop down boxes
|
Original Message
|
Name: liliyaw
Date: April 11, 2006 at 11:46:44 Pacific
Subject: jsp drop down boxesOS: linuxCPU/Ram: 524Model/Manufacturer: 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.
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: Michael J (by mjdamato)
Date: April 11, 2006 at 12:43:38 Pacific
Subject: jsp drop down boxes |
Reply: (edit)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
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: liliyaw
Date: April 11, 2006 at 13:41:25 Pacific
Subject: jsp drop down boxes |
Reply: (edit)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.
Report Offensive Follow Up For Removal
|
Use following form to reply to current message: