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 Rick Reumann <r...@reumann.net> on 2003/07/22 16:47:06 UTC

Way to compare scoped value to a class constant variable?

I'm wondering if there is a way I could compare a scoped variable to a
static constant variable that is in a class?

For example in Const class I have some levels like:

public static final int JVP_LEVEL = 3;

It would be nice if in my JSP I could do (after the import up top)..

<c:if test="${myScopedVar == Const.JVP_LEVEL}" />

I know I could just do ..

<c:if test="${myScopedVar == 3}" />

But it is clearer in the code to use the Constant name. Is it possible
to do this somehow?

Thanks,

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: Way to compare scoped value to a class constant variable?

Posted by Rick Reumann <r...@reumann.net>.
On Tue, 2003-07-22 at 10:52, Henri Yandell wrote:

> Unsure if JSTL 1.1 will allow this, but using the Unstandard taglib you
> can do:
> 
> <un:bind var="bob" type="your.package.Const" field="JVP_LEVEL"/>
> <c:if test="$myScopedVar == $bob">
> ..
> </c:if>
> 
> http://jakarta.apache.org/taglibs/sandbox/doc/unstandard-doc/intro.html

Killer! I'll have to check this out right now.

-- 
Rick



---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: Way to compare scoped value to a class constant variable?

Posted by Henri Yandell <ba...@generationjava.com>.
Unsure if JSTL 1.1 will allow this, but using the Unstandard taglib you
can do:

<un:bind var="bob" type="your.package.Const" field="JVP_LEVEL"/>
<c:if test="$myScopedVar == $bob">
..
</c:if>

http://jakarta.apache.org/taglibs/sandbox/doc/unstandard-doc/intro.html

Hen

On 22 Jul 2003, Rick Reumann wrote:

> I'm wondering if there is a way I could compare a scoped variable to a
> static constant variable that is in a class?
>
> For example in Const class I have some levels like:
>
> public static final int JVP_LEVEL = 3;
>
> It would be nice if in my JSP I could do (after the import up top)..
>
> <c:if test="${myScopedVar == Const.JVP_LEVEL}" />
>
> I know I could just do ..
>
> <c:if test="${myScopedVar == 3}" />
>
> But it is clearer in the code to use the Constant name. Is it possible
> to do this somehow?
>
> Thanks,
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org