<< Slides from "Java Development on Mac OS X" | Home | Pebble 1.4.1 available >>

Hacking Roller Velocity templates (or JSP isn't dead)

Dave points to a blog entry showing how to "hack" Roller to show friendly Google searches and, while it's a really nice feature, there's something else that I'd like to pick up on here. Many people have been moaning recently about how horrible JSP looks and how most pages contain lots of logic. But then you see Velocity templates like that! I will say no more. ;-)

Tags :


Re: Hacking Roller Velocity templates (or JSP isn't dead)

This is a matter of inappropriate use of Velocity coupled with deficiencies in the application. Putting logic like this in your web page regardless of whether it is in Velocity or JSP is wrong. This type of logic should be in a "glue" layer and implemented with a real scripting language (Jython, Beanshell, etc).

Re: Hacking Roller Velocity templates (or JSP isn't dead)

I couldn't agree more and if you go against best practice then anything will look bad! I just find it amusing that people often say that Velocity is better than JSP and yet you can still make the same mistakes and fall into the same traps.

Re: Hacking Roller Velocity templates (or JSP isn't dead)

Simon, I agree. Velocity is not much of an improvement over JSP. It allows logic in the presentation layer and that leads to entanglement. The main advantages of Velocity in regards to Roller are: 1) Velocity does not require javac compilation and 2) users cannot call arbitrary Java code and take down the blog server. JSP must be compiled and JSP allows users to call essentially any Java API that is in the classpath, that is unacceptible for a mutli-user system like Roller.

Re: Hacking Roller Velocity templates (or JSP isn't dead)

I should add that the Roller editor/admin UI is implemented in JSP with calls to the Struts and JSTL tag libraries. Velocity is used only for page and RSS rendering.

Re: Hacking Roller Velocity templates (or JSP isn't dead)

I think no matter which technology you use, there is always scope to abuse it in some way - JSP, Velocity, ASP, PHP, etc. If scripting languages like Groovy make there way into this space then I'm sure we'll see the same discussions!

I totally appreciate why you've not selected JSP as the "templating" technology for rendering pages in Roller and this is the one reason that I'm never going to implement a "sign up for your own blog" in Pebble. Although saying that, I *have* seen a customized version of the code running on the Internet where users can sign up. Perhaps I should put a massive disclaimer in the user guide saying, "make sure you trust the people you give blogs to"! ;-)

Hacking Roller templates. Show comments summary.

It looks like I have to learn how to better express myself. Surely it is not the way to implement such things in a proper MVC and that is why I call it a hack. It has been said already that the whole Velocity-based scripting does not really makes sense.

Hacking blog templates redux

My .02 on the whole hacking the various weblogs templates discussions (here, here) is that someone came up with a way to display Google hits from their referer list. The whole bit about it being a hack or Velocity pages can be as unreadable as JSPs wi...

Add a comment Send a TrackBack