Assume I have a jsp page with the following code : <% String name = (String) session.getValue("myName"); out.write(name) %> Now I execute it right out of the box without the myName session ever being created.. How can I prevent a nullpointerexception here ? I've theoritically understood the true arguement but never got around to using it.
Not sure if this is what you want, but one easy answer is:
Joined: Apr 11, 2001
Thats what I use.. actually the tertiary operator to populate name if the session is null.. What i was interested in was knowing if there is some kind of boolean true i can pass to getValue to automatically move " " or 0 to name if its null guess not