James Turner has written a short-n-sweet article on using indexed properties with DynaForms. Of course, you could use any ol' ActionForm, but you get the idea. If you're struggling with indexed properties in Struts, or you're just curious to know what they are, read this article (estimated time 5-10 minutes, 6 printed pages - mostly code).
Now if we could only convince James to use XHTML (lower case HTML, close your tags, etc.) in his examples. A big pet-peeve of mine is uppercase HTML - XHTML is lowercase and HTML works just the same with lowercase tag names/attributes. Here's to future compatibility!
We've been having an issue at work for awhile now where our .css and .js files are cached by a proxy server. When we update the app, we get a few users (behind the proxy server) that get served up an old style/script file, and the app looks like it's broken. So I added a super-simple cache-killer to our .js and .css files today. In my taglibs.jsp (included in every JSP), I added:
<%-- Create a variable that is the current time (in milliseconds) to kill
caching on the proxy server --%>
<jsp:useBean id="now" class="java.util.Date" />
<c:set var="cacheKiller">
<fmt:formatDate value="${now}" pattern="yyyyMMdd"/>
</c:set>
My date pattern only goes to the day because we don't update the site more than once in the same day. This way, the users will still get the stylesheet/script caching benefit of the browser, but now we control when the file is reloaded, rather than the proxy server. To make sure these files are re-fetched every request, you could use pattern="yyyyMMddHHmmssS" to get all the way down to the millisecond.
After adding this, I adjusted my baseLayout.jsp (Tiles template) to add my cacheKiller as a parameter to the src attributes of scripts and stylesheets.
<%-- Get Javascript List --%>
<tiles:useAttribute name="scripts" ignore="true"/>
<c:forEach var="js" items="${scripts}">
<script type="text/javascript"
src="<html-el:rewrite page="${js}"/>?<c:out
value="${cacheKiller}"/>"></script>
</c:forEach>
Works like a charm!
I found a good tidbit this morning (on the java-writers' mailing list) titled "The economics of writing a computer trade book." Good stuff to read if you're an author or wanting to be an author. Scott estimates the average payout for authors is $20/page for books and $50-$250/page for magazine articles.
Bottom line, write magazine articles if you're doing it for money. If you're doing it for fame, write a book. If you're writing a book, warn your family and friends that you'll be unavailable for the duration of your writing. Don't forget to mention you'll be stressed out, irritable and you'll bitch a lot that they're not paying you nearly enough for your efforts. Then plan a party when the book is released and give yourself (and your family) a pat on the back. I've been waiting to plan this party since March!