tags:

views:

22

answers:

1

How i can find values is set to variable in session or not?

if(session.getAttribute("tot_demand"))//need to change

  //if value is already set then do this.

else

  //if not set then do this.

Please answer what i need to write for above code.

Thanks in advance.

+2  A: 

Compare to null:

if (session.getAttribute("tot_demand") != null) {
   // already set
} else {
   // not yet set
}
Bozho