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.
tool
keyconst/key
that's very strange. what you're doing looks fine to me and
definitely should work. and no, it shouldn't make a difference
whether the methods are static or not. they just need to be public
methods in public classes. so, the first thing i suggest
double-checking is that the Constants class is
Hello,
I am trying to create a macro that can either take a single string
parameter, or an array of strings.
The code looks something like this:
#macro(get $things)
#foreach($thing in $things)
## do something...
#end
#end
What I would like to happen is that if $things is only
Hello,
I am trying to create a macro that can either take a single string
parameter, or an array of strings.
The code looks something like this:
#macro(get $things)
#foreach($thing in $things)
## do something...
#end
#end
What I would like to happen is that if $things is only
Hi,
Why don't you just assign $things to an array with 1 element instead of just to
the string object?
If you do this then you definitely shouldn't have problems.
Hope this helps,
Sayed Ibrahim Hashimi
www.cise.ufl.edu/~sih
-Original Message-
From: e v a n l e o n a r d [mailto:[EMAIL
I guess its just a usability thing. To be able to pass a single string
would avoid careless errors, that's all. I may settle for what you suggest
though.
-Evan
-Original Message-
From: Sayed Hashimi [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 02, 2005 1:45 PM
To: Velocity Users
How bout this:
#macro(get $things)
#set($didRun = 0 )
#foreach($thing in $things)
## do something...
#set($didRun = 1 )
#end
#this will test if the above loop was executed and if not
#but the variable is not null then it must be single object.
Hi,
I remember having problems with the introspector when accessing
static methods of a class itself. But somehow I cannot believe
that it is causing problems when the class was instantiated.
If you tested removing the static from the getter, and it still
does not work:
public String
That's might work. Not as clean as I might like, but it'll be tucked away in
the macro anyway.
Thank you for the idea Sayed,
Evan
-Original Message-
From: Sayed Hashimi [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 02, 2005 2:21 PM
To: Velocity Users List
Subject: RE: For each on
Hello,
If I use JarResourceLoader, will any uploads of new .jar with
templates be notified by it?
I.e., I first uploaded templates.jar, started webapp,
then reuploaded modified templates.jar - will my modifications
take place without restarting webapplication?
Thank you in advance.
Hi Ravikanth,
I would like to create a object reference in template using new
keyword like what we do in java
String obj = new String()
I need to put RenderTool instance in context and use it to fix some
problem. I know that i can put it to context from the java code where
the template
Hi Matthew,
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.
For the time being,
Hi Stan,
If I use JarResourceLoader, will any uploads of new .jar with
templates be notified by it?
I.e., I first uploaded templates.jar, started webapp,
then reuploaded modified templates.jar - will my modifications
take place without restarting webapplication?
It should. If you look
Hi Christophe,
In my effort to find a solution to the problem I mentioned in another post
I'm trying to setup minimal Velocity logging...
There must be something wrong with my setup (or with me :-)).
## snip
4) velocity.properties content is
runtime.log = velocity.log
14 matches
Mail list logo