I want to check for all my Http parameters sent by my client
to my servlet.I do so with request.getParameter("");
Instead of performing client-side validation check using java script. If i choose to perform server-side validation...then how do I check whether my parameters are DEAD/ALIVE.
String name = ((String)request.getparameter("name")).trim();
// checking for paramter validation
perform some operation.ie re-direct the user to another JSP , with error message so that I do not process his request .
How do I check my string variable name has reference or NO
All that is required is a null check. If a user did not fill in a field, the request.getParameter("parameterName") will equal null.
As far as my knowledge is concerned you don't need to do object cast as it always returns String. If you have multiselect you have to use request.getParameterValues which returns String array. other wise you have to use request.getParameter only.
except check boxes and radio buttons every thing else returns empty string if it doesn't contain any value. if the name exists it will return empty string, other wise it will return null.
don't use .trim() when you r getting parameter value. If it is null it will give nullpointer exception.
normally you can do like this
String var = "";
if (request.getParameter("paramName") ! = null)
var = request.getParameter("paramName").trim();