ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Migrating to Velocity
Subject:   Not convinced
Date:   2004-04-19 15:32:40
From:   ehauser@www.in.gov
There is no reason to use the useBean in this example except for the fact that it makes the JSP look like more lines of code. Instead of the scriptlet, why not just use an expression (assuming JSP 2.0, if not you could just use c:out):


${sessionScope.test.time}


Also, if you are using JSP 2.0, there is no need to use includes either. JSP 2.0 provides an option for wrapping that goes in web.xml:


<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<include-prelude>header.jsp</include-prelude>
<include-coda>footer.jsp</include-coda>
</jsp-property-group>
</jsp-config>


I will agree with you that Velocity templates are a good replacement for tag libraries. I've enjoyed using Velocity in conjunction with Webwork. I don't think that your article provides a convincing case that Velocity should be used over JSP for your example however.