tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Bremford" <mi...@paperx.com>
Subject RE: Help! How to deal with null session variables??
Date Thu, 14 Sep 2000 15:25:51 GMT
String MyVal=(session.getValue("x")!=null ? session.getValue("x").toString()
: "");

:-)

Cheers... Mike

> -----Original Message-----
> From: John Coonrod [mailto:jc@thp.org]
> Sent: 14 September 2000 16:04
> To: tomcat-user@jakarta.apache.org
> Subject: Help! How to deal with null session variables??
>
>
> I frequently crash pages with nullPointerExceptions when
> trying to get
> session variables into a string.
>
> What I want is:
>
> String MyVal=session.getValue("x").toString();
>
> and if x isn't there, I'd like ""
>
>
>
>
>


Mime
View raw message