What about something like:

           <logic:equal property="value" value="0">
             Print some text
           </logic:equal>

or  JSTL

<c:choose>
  <c:when test="${Power.value == Power.OFF}">
     Power off
  </c:when>
  <c:otherwise>
     Power on
  </c:otherwise>
</c:choose>

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 17, 2003 11:55 AM
To: [EMAIL PROTECTED]
Subject: a tag to check an "enum"?


What approaches are there to using jsp tags checking java "enums". And NOT
using scriplets..

So I have some kind of state which I want to check, based on enums. Am I
forced to write my own custom tag? OR are there ways with existing ones.

By enums, I mean class, private constructor, public static final fields,
etc.. Described many places in java articles.
Example class

public class Power implements Serializable {
      public static final Power OFF = new Power(0);
      public static final Power ON = new Power(1);

      private int _value;
      private Power(int value) {
            _value= value;
      }
      ..
      ..
      readResolve...
      ..
      ..
}
So assuming a page scope bean has an accessor to a Power instance. I want
to check if the power is on or off and print different text out.
What are the approaches commonly used?

thanks
Henrik Bentel



---------------------------------------------------------------------
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]

Reply via email to