You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by "Agrawal, Anuj (Anuj)** CTR **" <ag...@lucent.com> on 2002/03/02 19:37:05 UTC

how to test session variables

I'd like to use either the <when> or <if> tags to test for existence of a
session variable.

I tried:

<c:if test="$session.username != null">
	session.username is available
</cf:if>

But it didn't recognize $session.

I'm trying to replace the existing working code with JSTL tags:
<%
	if (session.getAttribute("username") != null) {
%>
	session.username is available
<%
	}
%>

Any pointers would be appreciated.
Thanks.
Anuj.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: how to test session variables

Posted by Shawn Bayern <ba...@essentially.net>.
On Sat, 2 Mar 2002, Agrawal, Anuj (Anuj)** CTR ** wrote:

> I'd like to use either the <when> or <if> tags to test for existence of a
> session variable.
> 
> I tried:
> 
> <c:if test="$session.username != null">
> 	session.username is available
> </cf:if>

The syntax for this will depend on the final JSTL expression language.  
We hope that the upcoming beta release will contain a more final version,
so I'll hold off commenting for now on workarounds in the preliminary
(EA3) languages, if that's all right.  In a week, things should be closer
to their eventual form.

--
Shawn Bayern
Author, "JSP Standard Tag Library"  http://www.jstlbook.com
(coming this spring from Manning Publications)


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>