wood burning stoves 2.0
The moose likes JSP and the fly likes ComboBox using JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "ComboBox using JSP" Watch "ComboBox using JSP" New topic

ComboBox using JSP

adriana cardoso

Joined: Sep 26, 2006
Posts: 9

Some person has ?

I need one soon code using Vector to list for example a field of my called table Name and in mine jsp implements one ComboBox.I have with difficulties to add to this ComboBox listing the names my jsp.
Please help me i need deliver soon.


adriana cardoso

Joined: Sep 26, 2006
Posts: 9
please help me....
Stefan Evans

Joined: Jul 06, 2005
Posts: 1580
patience grasshopper. Your question has been up less than two hours.
And I'm not even sure I understand the question.

Where is the data coming from?
What code have you already got?
Which bit are you having trouble with?

I can break it down into two broad sections.
- Code to query database table and put results into List. (in a bean)
- JSP page rendering the dropdown box. Use JSTL to loop through the list and generate an option element for each item in the list.

If you are using a framework like Struts/JSF there are custom tags that can help you with that second part.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63852

There is no such thing as a Combo box in HTML. Do you mean a select element? (sometines called a dropdown).

[Asking smart questions] [About Bear] [Books by Bear]
reddy yeruva

Joined: Oct 18, 2006
Posts: 18
hai.. what i understand from you question is you want to place the database values in the combobox in the jsp page yes?

if yes

the logic lis very simple...

<SELECT class=drop style="WIDTH: 143px" name=scountry >
<option selected>Select a Country</option>
<option selected value=<%=test%>><%=test%></option>
<% while(rs.next()) {%>

st1= rs.getString("countryname").trim();

<option value="<%=st1%>"><%=st1%></option>


Y.Tirupati Reddy<br />reddy.yeruva@gmail.com
Marko Debac
Ranch Hand

Joined: Aug 21, 2006
Posts: 121
or you can try this:

I agree. Here's the link: http://aspose.com/file-tools
subject: ComboBox using JSP
It's not a secret anymore!