Since the JSTL expression language is designed to expose JavaBean
properties, it's probably best to represent "constants" as such
properties.  E.g.,

  public class Constants {
    private final int BIG_SPENDER = 100;

    public int getBigSpender() { return BIG_SPENDER; }
  }

will let you use an expression like

  ${customer.credit > constants.bigSpender}

The JSTL expression language doesn't support static member fields in part
beacuse they might clash with JavaBean properties.

Shawn

On 10 Apr 2002, Glenn R. Kronschnabl wrote:

> A lot of the jstl examples you see are like:
> 
> <c:if test="${customer.credit > 100}">
> 
> what I would like to do is to remove the hardcoded '100'.
> Ideally, I could have something close to:
> 
> <%@ page import="my.com.Constants" %>
> 
> <c:if test="${customer.credit > Constants.BIG_SPENDER}">
> 
> of course the above does not work.  What's the best way to do what I
> want?  Should I use the c-rt?  I know the following works.
> 
> <c_rt:if test="<%= customer.getCredit() > Constants.BIG_SPENDER %>"
> 
> But I'm under the mindset to avoid the -rt versions - is that a
> misconception?
> 
> TIA,
> Glenn
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 


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

Reply via email to