There's another interesting discussion taking place over on the struts-dev list again. Man, I'm glad I subscribed (again) to this list last week! It started out as a discussion of JSP vs. Velocity and Craig (McClanahan) provided an interesting evolution of JSP (and comparison to Velocity).
Velocity:
========
(Note -- it's assumed that the Customer collection has been stored in the
VelocityContext by some preceding business logic.)
\#foreach $result in $results {
<tr>
<td>$result.ID</td>
<td>$result.Name</td>
</tr>
}
JSP 1.1 (with Scriptlets):
=========================
<%
Customer custs = ...;
for (int i=0; i < custs.length; i++) {
%>
<tr>
<td><%= custs[i].getId() %></td>
<td><%= custs[i].getName() %></td>
</tr>
<%
}
%>
JSP 1.1 (with custom tags):
==========================
(Note -- it is assumed here and in the following examples that the
Customer collection has been stored by some preceding business logic.)
<logic:iterate id="cust" name="custs">
<tr>
<td><jsp:getProperty name="cust" property="id"/></td>
<td><jsp:getProperty name="cust" property="name"/></td>
</tr>
</logic:iterate>
JSP 1.2 + JSTL 1.0:
==================
<c:forEach var="cust" items="${custs}">
<tr>
<td><c:out value="${cust.id}"/></td>
<td><c:out value="${cust.name}"/></td>
</tr>
</c:forEach>
JSP 2.0 + JSTL 1.0:
==================
<c:forEach var="cust" items="${custs}">
<tr>
<td>${cust.id}</td>
<td>${cust.name}</td>
</tr>
</c:forEach>
</pre>
I can't wait for JSP 2.0 - it's going to make everything so much easier. Once again, we have exciting times for the Java world. With the power of JSP 2.0 and XDoclet, deadlines should be a non-issue. Now we just have to figure out the best way to use them, and the fastest way to pump out a Struts project. Wouldn't it be awesome if you you could add a new column to a table, build your project using Ant and XDoclet and whalla, all your classes are updated! That would be cool - and I think it's possible. Now I just have to figure out how - and fast!
Any of your designer-types want to contribute a logo candidate for Struts? They're looking for one!
Jeff Duska expresses his frustration with Roller - he wrote a nice long post and when he clicked on "Post to Weblog", he lost it all. This happens to me all the time, but since Roller used container-managed authentication my post still submits after I re-login. I hope Jeff didn't just give up after he saw the login screen. Even if this fails, the back button should get you back to your post. Unless you're using the Ekit Editor - which I strongly advise you don't use because of this. Once you leave the page, and click back - Ekit doesn't remember your post - and in that case, I agree - ughhhh!
I've been asked to write some chapters in an upcoming JSP book that covers JSP 2.0 (JSR 152) and Servlets 2.4 (JSR 154). I'm thinking of doing a chapter on Struts and a chapter on Security. In the Struts chapter, I'd like to cover developing a Struts application using Ant, XDoclet and Middlegen - but I don't know if Middlegen supports Struts 1.1, nor if the generated JSPs can be modified to use JSP 2.0 syntax. I'd hate to spend a lot of time contributing to these projects to make my struts-based app work. So I'm asking you (the developers) what kind of app you'd like to see me develop?
For the Security chapter, I was thinking of developing an app that has form-based authentication, a Filter to look up the user's information, password encryption and an SSL login.
For the Struts chapter, I want to develop an app that developers can use to 1) learn about Struts and JSP 2.0 and 2) also has code they can use in their own projects. I'm torn because I really want to redo this photo album software (the site doesn't appear to be rendering images right now), but I want it to be useful. Hopefully by using XDoclet extensively, it doesn't matter what I write - the build and generation process will be useful.
My biggest hurdle to overcome in all this - it's due in 3 weeks! That should be a nice ball of stress that will keep me from sleeping night after night. Any advice or suggestions are welcome.
To see what JSP 2.0 is all about, check out the
JSP 2.0 Early Access Release and here is a short and sweet article of changes.