Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_jsp thread: How to handle a null variable in JSP


Message #1 by ndramkumar@s... on 17 Jan 2001 11:54:40 -0000
String flag="";

if (flag==null || flag.equals("")) { //try && also, depending on the
context.

//do something
}else{

//do something else
}


> How to handle a null variable in JSP.
> 
> for ex:-
> 
> String flag;
> 
> i want to perform an action if it is null and 
> another action if it is not null.
> 
> can i check like this:- if (flag==null)
> if(flag!=null)
> 
> sometimes it works fine and othertimes it doesn\'t 
> work.
> 
> what is the reason and the solution.

  Return to Index