This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes select tag in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "select tag in jsp" Watch "select tag in jsp" New topic
Author

select tag in jsp

ashish sood
Greenhorn

Joined: Oct 03, 2009
Posts: 8
hello,
I am trying to populate my select tag with values from the database but problem is that i am getting different drop down menus for each value of database.

<form action="checkt1.jsp" method="post">
<select name="val1"><option value="not specified">S E L E C T</option>
<%
while (rs2.next())
{
val=rs2.getString(1);
out.println("<option value='"+val+"'>"+val+"</option>");
}
%>
</select>

please help..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

Have you looked at the HTML being sent to the browser? Is it correct?

And why are you still using Java scriptlets in a JP?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: select tag in jsp
 
Similar Threads
Using html drop down box to retain values (in a jsp page)
Multiple select box problems
returning value from jQuery
Inserting single column values of database table into multiple columns of jtable and do comparison
creating dymic optionvalues in select box from arraylist values in jsp