aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes select a value from a drop down menu bar in a HTML page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "select a value from a drop down menu bar in a HTML page" Watch "select a value from a drop down menu bar in a HTML page" New topic
Author

select a value from a drop down menu bar in a HTML page

Mayank Adhikari
Greenhorn

Joined: Nov 17, 2012
Posts: 12
Hi,

I wish to select a value from a drop down menu bar in a HTML page and then pass the value to some other jsp page where it will be used as an input to a sql query.
But when i am check the input in jsp page then it is showing empty value.


MY DROP DOWN HTML is as below

<form method="post" action="test.jsp" onsubmit="return validLogin();">
<select name="Employee">
<option value="opt1" name="username">opt1</option>
<option value="opt2" name="username">opt2</option>
<option value="opt3" name="username">opt3</option>
</select>
<input type="submit" value="sub"/>
</form>

MY JSP PAGE: test.jsp

<%
System.out.println("Oracle Connect Example.");
try {
String username = request.getParameter("username");
out.println(username);
}
%>


Please any suggestion on this will be highly appreciated.



Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60046
    
  65

option elements do not have names. Only the select element has a name.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mayank Adhikari
Greenhorn

Joined: Nov 17, 2012
Posts: 12
Thanks a lot it worked
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: select a value from a drop down menu bar in a HTML page
 
Similar Threads
can anyone tell me how do we update the values in servlet?
selection box problem
adding 'option' into 'select'...
How to add form fields dynamically
how to get form parameters data to a servlet?