File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "ComboBox using JSP" Watch "ComboBox using JSP" New topic
Author

ComboBox using JSP

adriana cardoso
Greenhorn

Joined: Sep 26, 2006
Posts: 9
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
adriana cardoso
Greenhorn

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

Joined: Jul 06, 2005
Posts: 1018
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

Joined: Jan 10, 2002
Posts: 61105
    
  66

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
reddy yeruva
Greenhorn

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>
<%
}

%>
</SELECT>


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

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



cheers
 
Don't get me started about those stupid light bulbs.
 
subject: ComboBox using JSP