velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Baynes" <kbay...@seagullsw.com>
Subject RE: discarding method return values
Date Mon, 04 Nov 2002 19:28:40 GMT



> >Not to be contentious, merely friendly discussion here. :-)
>
> Yup, no worries.

Good. :-)

>
> >  Once you are in the Template, what is the difference between
> >writing the above list and calling #foreach, or simply writing:
> ><select name="myWordRoots">
> >  <option value="Rhinocerotidae">Rhinoceros
> >  <option value="kallipugos">callipygian
> >  ....
> ></select>
>
> I interpret this question as: "Why use an array at all?"  You guessed
> part of my answer below, which is that I might want to use the array
> in more than one place.  Or I might want to do something with the
> array index, like:

Let me clarify: my question is "Why hardcode an array *in the Velocity
Template*?". All your looping examples are perfectly correct, my focus is on
what level you acquire the data and make decisions on it. I store data in a
file or a database, then pull the data into my controller, make decisions on
it and place the finished array (or Object) into the Velocity context.

I see "if sunday then exclude lactovegetarian" as a business logic /
Controller decision, and "if odd row, then gray background" as a View
decision.

Also, IMHO storing Data in a Template is a 'Bad Thing' - (no offense). It
seems cleaner to store data externally, in a properties file, in an XML
file, in a database. I use XML files for this purpose, they are easy to read
and change. I don't want any data hard-coded in my templates.

Again, this is an interesting applied MVC theory discussion to me, I'm not
trying to be contentious.

~k





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


Mime
View raw message