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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Checkbox Value 1

Status
Not open for further replies.

solok

Programmer
Oct 1, 2003
13
US
I'm new to JSP and I'm setting up a search page with the capability to search either a specific directory or the entire site. How can I use JSP code to display / get the checkbox value to include in an if / else statement?
[afro]
 
assuming a POST request and the following checkbox:
Code:
<input type="checkbox" name="foo" value="bar" />
then:
Code:
String fooBox = request.getParameter("foo");
if (fooBox != null && fooBox.equals("bar")) {
  ...
}

although the
&& fooBox.equals("bar")
part is kind of redundant, since when the box is not checked, no value will be passed, and "fooBox" will be null


-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
i like your sleeves...they're real big
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top