• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ComboBox using JSP

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please help me....
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
or you can try this:



cheers
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic