Re: whether to check null or not
Posted By:
pavan_kumar
Posted On:
Tuesday, October 10, 2006 08:06 AM
It is always better to check the request variable for null.if u dont check the variable for null and try to apply the equals method there is a chance for occuring null pointer exception.Because u written acode like
String var=request.getParameter("somevar");
(if(var.equals.("somevalue")))
{
forward to some page
}
if u dont get the request variable a null will b there in the variable var.so by appling equals method using null results in null poiter exception. so it is always better to check a variable for null.