no, tried that. Thanks though.
The tags doesn't quite understand how to compare them. The enum bean
doesn't have a getValue method, since it's a java "enum". and mine are
generated Corba entities from an IDL, so I can't put any getValue method in
either.
Also, how does one make the JSP engine know what Power.OFF means? won't it
try to look it a bean named "Power" in the different scopes? which won't
work cause in reality it should do instance comparison on the singeltons.
-Henrik Bentel
"Mike Jasnowski" <[EMAIL PROTECTED]> on 07/17/2003 11:12:12 AM
Please respond to "Struts Users Mailing List"
<[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
cc:
Subject: RE: a tag to check an "enum"?
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]