Friday, January 8, 2010

JSTL is Old Fashioned But Cool

I am not afraid to say that I really like JSTL. It may be old fashioned, but it gets the job done very nicely. Is it just me, or do many of these new frameworks just seem like they don't buy you all that much. Anyway I created this post to shove my favorite JSTL expressions/hacks, toolkits etc. I'll just keep editing it to add more as I think of them/find new ones.

---

Quickly get the current year from JSTL (and jsp)

<jsp:usebean id="now" class="java.util.Date">
<c:set var="year" scope="page" value="${now.year+1900}">

---

I really like the displaytag library. So simple and powerful (especially for internal crud pages).

http://displaytag.sf.net

---

Why does CSS suck so bad? They forget basic things like allowing URLs to break in a table so the table formatting doesn't get thrown out. Here is a snipped to stick hidden breaks in a url so that it will wrap (oh, and still escape xml).... Argh!

${fn:replace(fn:escapeXml(variablename),"/","/")}

0 comments: