"Geir Magnusson Jr." wrote:
> 
> Jari Worsley wrote:
> >
<snip>

> >
> > This seems to me that you're advocating logic being part of the
> > template? Doesn't this "break" the whole MVC idea where you try and do
> > all processing before hitting the page, then just use some template
> > mechanism (JSP etc) to display data in the page?
> 
> Yes and no. To a real purist, the answer is indeed yes for many of the
> possible tools - there are some wacky ones (IMHO) right now in the seed
> set that do things like process control.
> 
> However, there are real needs for simple logic, such as row coloring and
> layout - that's why Velocity is contrained to simple integer math in the
> template language itself.  For example, you have a large list of items,
> say stock tickers, and you want to lay them out in a table of 7 columns,
> one per cell.  In velocity, modulo some edge-effect details :
> 
<snip>

> 
> The point here is to illustrate how simple math and logic has a place in
> the designers 'toolkit'.
> 
> I don't know how to avoid having logic - I don't think a tool that spits
> out a complete table is appropos, as then the generation of markup moved
> out of View into M or C (the land of the Java programmer anyway).
> 

yes agree with you there. There will always be a need for some layout
logic in views, especially when it comes to things like lists, or
multicolumned layouts etc - just look at the complexity of some fo the 
AWT Layout classes ;). I was just trying to understand what you were
advocating. 


> >
> > To me
> > $sometool.apicall($arg1, $arg2) is just as much a programming call as
> > a JSP style <%= request.getAttribute("foo") %>.
> 
> 1) In Velocity, you would just do
> 
> $request.getAttribute("foo")
> 
> 2) In JSP, you wouldn't have to resort to scriptlets, right?  You could
> easily access via a bean access tag or a custom tag...

Yes, bad example on my part I should have said something like:
<%= ( somevar > 1) ? "foo" : "bar" %>

> 
> 
> The point here is not to engage again in a JSP vs templating discussion

! I haven't had that discussion ever, and don't see the need, especially
on a "commons" list rather than a "religious wars about architecture X"
list :)

Jari
--
Jari Worsley
Senior Programmer
Hyperlink Interactive Ltd

Reply via email to