velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Van Horn <>
Subject best practice question
Date Wed, 02 Mar 2005 13:58:35 GMT
I use a Constants class in my application to hold a bunch of strings 
used for things like request attribute keys etc. In my templates, I 
would also like to eliminate the hard-coded strings, and I thought I 
could do that by using the Constants class as a tool.


public class Constants {

	public static final String PROPERTY = "";
	//I even tried this:
	public static String getPROPERTY() {
		return PROPERTY;

in my template
both turn up as invalid references.

but $const.toString() works, so an object must be there.

Is this something to do with static methods? I added a non-static method 
to test, but that didn't work either.

Do I need to implement the ViewTool interface? What should I do in 
init() then?

According to the docs available I thought this was possible, but now I 
am stumped. Hope I won't feel too stupid upon figuring this out.

Thanks for any help,
Matt Van Horn

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message