You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by piero de salvia <pi...@yahoo.com> on 2001/06/08 22:10:55 UTC
Velocity syntax question (beginner question)
hi guys,
I'm sharpening my Velocity skills, maybe one day I'll
become a developer...
In the meantime, this works:
#set( $Animals = [ "cats", "dogs", "mice"] )
but this does not:
#set( $Animals = [ "cats",
"dogs",
"mice"] )
i.e. parser won't take newlines and will complain like
so:
apache.velocity.exception.ParseErrorException:
Encountered "\n" at line 2, column 53. Was expecting
one of: "[" ... ... "true" ... "false" ... ... ... "{"
...
What to do if I have a long list and want the newlines
to make it clearer to read?
piero de salvia
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
Re: Velocity syntax question (beginner question)
Posted by Jon Stevens <jo...@latchkey.com>.
on 6/8/01 2:31 PM, "Jon Stevens" <jo...@latchkey.com> wrote:
> Instead of hard coding values into your templates, store them in a database
> (of some sort...this could even be a flat text file)...then provide an
> object which can read that file in and translate that into an ArrayList
> which you can iterate over.
Sorry - I didn't mean to neglect to answer your question.
You are correct, the parser doesn't like newlines inside directives, so
we're stuck with putting lists on a single line.
As suggested before, depending on how you're using the list, it still
might make more sense to have the Developer add a List object into the
context for you to manipulate.
-jon
--
"Open source is not available to commercial companies."
-Steve Balmer, CEO Microsoft
<http://www.suntimes.com/output/tech/cst-fin-micro01.html>
Re: Velocity syntax question (beginner question)
Posted by Jon Stevens <jo...@latchkey.com>.
on 6/8/01 1:10 PM, "piero de salvia" <pi...@yahoo.com> wrote:
> What to do if I have a long list and want the newlines
> to make it clearer to read?
Instead of hard coding values into your templates, store them in a database
(of some sort...this could even be a flat text file)...then provide an
object which can read that file in and translate that into an ArrayList
which you can iterate over.
-jon
--
"Open source is not available to commercial companies."
-Steve Balmer, CEO Microsoft
<http://www.suntimes.com/output/tech/cst-fin-micro01.html>