Re: JSTL & HTML Options

2005-02-03 Thread Jeff Beal
<%= Constants.MY_CONSTANT %>

-- Jeff
CRANFORD, CHRIS wrote:
I have defined a test class with constants as follows:
public class Constants
{
  public final static String MY_CONSTANT = "OK";
}
What I want to do is in my html:option tag, I want to set the value
associated with that tag to the constant MY_CONSTANT.  How would one do
this?
-=cc=-

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


RE: JSTL & HTML Options

2005-02-03 Thread Slattery, Tim - BLS
> So you're not able to reference static public final 
> properties in the same fashion as scriplets? 
> <%=Constants.MY_CONSTANT%>

Tags are fundamentally different from scriptlets. Scriptlets are simply Java
code, and you can address a member variable of a class from a scriptlet just
as you could in any Java code. (Providing its not "private" or "protected",
of course). 

A tag is a small program that interprets its input, as any program must.
JSTL and struts tags access data from classes *only* via accessor functions.

--
Tim Slattery
[EMAIL PROTECTED]


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



RE: JSTL & HTML Options

2005-02-03 Thread CRANFORD, CHRIS
So you're not able to reference static public final properties in the same
fashion as scriplets?
<%=Constants.MY_CONSTANT%>

-Original Message-
From: Slattery, Tim - BLS [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 03, 2005 11:28 AM
To: 'Struts Users Mailing List'
Subject: RE: JSTL & HTML Options


> I have defined a test class with constants as follows:
 
> public class Constants
> {
>   public final static String MY_CONSTANT = "OK";
> }
 
> What I want to do is in my html:option tag, I want to set the
> value associated with that tag to the constant MY_CONSTANT.  
> How would one do this?

Write a getter method for that value:

String getMyConstant()
{
return MY_CONSTANT;
}

The  tag can now reference the property "myConstant".

--
Tim Slattery
[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]



RE: JSTL & HTML Options

2005-02-03 Thread Slattery, Tim - BLS
> I have defined a test class with constants as follows:
 
> public class Constants
> {
>   public final static String MY_CONSTANT = "OK";
> }
 
> What I want to do is in my html:option tag, I want to set the 
> value associated with that tag to the constant MY_CONSTANT.  
> How would one do this?

Write a getter method for that value:

String getMyConstant()
{
return MY_CONSTANT;
}

The  tag can now reference the property "myConstant".

--
Tim Slattery
[EMAIL PROTECTED]


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