• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ComboBox using JSP

 
adriana cardoso
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,


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
 
adriana cardoso
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please help me....
 
Stefan Evans
Bartender
Posts: 1784
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no such thing as a Combo box in HTML. Do you mean a select element? (sometines called a dropdown).
 
reddy yeruva
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
<%
}

%>
</SELECT>
 
Marko Debac
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
or you can try this:



cheers
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic