Applying JSTL to the Blog Code

03 March 2004

JSP Standard Taglibs have definitely learned a bit from previous efforts like Struts taglibs. Everything is built upon an expression language which makes accessing fields and objects much easier from within JSP. I've been able to trim quite a few bytes from my JSP using this more terse taglib set. Additionally, these tags can be applied in other web apps without using Struts.

Since my JBoss instance has Tomcat 4.x integrated instead of 5.x, I'm using Jakarta Standard Taglibs 1.0.

Here are some examples of the changes:

<bean:write name = "address" property = "state"/> <c:out value = ${address.state}"/>
<logic:notEmpty name = "pref" property = "paged"> <c:if test = "${pref.paged != null}">

Update (3 March 2004): Yay, I'm done and I've deployed it. It shouldn't look much different except for the last comment time which is new.

Filed Under: Java Blog-Code