Make sure to put the entire test within the EL expr delimiters:

<c:if test="${requestScope.mode == 'a'}">
  ...
</c:if>

The "scope" attribute is used when you also provide the "var" attribute to store
the result of the tested expression (it will be of type Boolean).

Quoting Günther Wieser <[EMAIL PROTECTED]>:

>  
> i think your test won't work as strings get compared using the equal method
> and not "==" (but i have no idea what the "test" attribute does in the tag
> class....).
> 
> if you use
> <logic:equals name="mode" value="a">whatever needs to be done</logic:equals>
> it should work (at least it works for me ;-) )
> 
> kr,
> guenther
> 
> -----Ursprüngliche Nachricht-----
> Von: David Johnson [mailto:[EMAIL PROTECTED] 
> Gesendet: Dienstag, 01. März 2005 00:24
> An: Struts Users Mailing List
> Betreff: JSTL c:if question
> 
> a little off topic but..
> 
> I have a variable (a string named "mode") in request scope and I want to
> display something conditionally in the JSP. Right now, I have the following,
> which doesnt work. The error is
> 
> 2: Illegal scope attribute without var in "c:if" tag.
> 
> What am I doing wrong?
> 
> <c:if test="${mode}=='a'" scope="request">
>    first thing
> </c:if>
> <c:if test="${mode}=='b'" scope="request">
>    second thing
> </c:if>
> --
> -Dave
> [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to