Reputation: 43
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.
What do I need to write, for the above code to work?
Upvotes: 2
Views: 1475
Reputation: 597026
Compare to null
:
if (session.getAttribute("tot_demand") != null) {
// already set
} else {
// not yet set
}
Upvotes: 6