velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Wilson" <andrew.wil...@db.com>
Subject RE: Usage question.
Date Tue, 18 Jan 2005 04:29:10 GMT
No, its not a literal, basically its an enum implemented with Strings.

You're right that I can get around the problem by using the underlying
string, but I wanted more type safety by specifying the compile reference.

ie the definition is (with package etc)

public static final String com.foo.Request.ID = "ID";

Then I use this to put things in a HashMap.

I can get this to work using 

${request.getProperty("ID")};

But I wanted the compile time safety of :

${request.getProperty(Request.ID")};

I know Im stretching Velocity (which I really like having used WebMacro
ages ago) but it would be nice...

Regards,
Andrew.

-----Original Message-----
From: mkienenb@alaska.net [mailto:mkienenb@alaska.net] 
Sent: Tuesday, 18 January 2005 3:10 PM
To: velocity-user@jakarta.apache.org
Subject: Re: Usage question.

Andrew Wilson <andrew.wilson@db.com> wrote:
> Id like to include the following code in my Velocity Template:
> 
> ${request.getProperty(Request.ID)}
> 
> Unfortunately, this doesn't compile.
> 
> Is there a clever way I can do this with a Macro?
> Since request is an instance of Request I would also be happy with
> 
> ${request.getProperty(${request.ID})}

If "Request.ID" is a literal, put it in quotes.
If it's not a literal, you'll have to provide us with more information.

-Mike

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

RE:

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


Mime
View raw message