Originally posted by ben oliver:
If I want to see if a checkbox is checked, shall I check
2. if it is checked, request.getParameter("MyCheckBoxName").equalsIgnoreCase("on") will be true. Right ?
Not necessarily.
If your checkbox is created without a "value" attribute, the default value "on" will be sent up in the form request when the box is checked.
If you set a value, then the value will be sent up, if it is checked.
In either case, if the box is unchecked, the browser will send up nothing.
It will be as if the checkbox didn't exist in the form.
In this case, getParameter will return null.
Note: It will also return null if the name is missspelled.