Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getParameter ? in JSP

Status
Not open for further replies.

zeero

Programmer
Aug 4, 2004
60
US
how do I get parameters from a drop down menu in JSP?

I've got a drop down menu with the following code:

Code:
<select name=server">
<option value="server1"> Server 1
<option value="server2"> Server 2
</select>

and then:

Code:
String server=request.getParameter("server");

could I do an if else statement? something like:
Code:
if(server=="server1"){
...
}

I know my syntax is bad, sorry.
 
something like :
Code:
String server = request.getParameter("server");
if (server == null) server = "";

if (server.equals("server1")) {

} else if (server.equals("server2")) {

// not found ...
} else {

}

--------------------------------------------------
Free Database Connection Pooling Software
 
perfect, thank you again sedj. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top