Tuesday January 23, 2007
Simplified UI Tags in Struts 2 Struts 2.0.3 contains a much needed simplification of its UI tag libraries. Before 2.0.3, you had to define a property three times (in the value, label and name attributes):
<s:textfield label="%{getText('user.firstName')}" name="user.firstName"
value="%{user.firstName}" cssClass="text medium"/>
In 2.0.3+, you can use the "key" attribute to replace all these attributes. For example:
<s:textfield key="user.firstName" cssClass="text medium"/>
One of the things I really like about WebWork/Struts 2 is the previous examples have the ability to write out the entire form row, rather than just an input field. Even better, the markup rendered is customizable via FreeMarker templates.
The bad news is Struts 2.0.3 never got released because the struts-annotations project hasn't had a release yet (good ol' Mavenism). The good news is Struts 2.0.4 is rumored to be out by the end of the month. In the meantime, if you're using Maven 2, you can use AppFuse's repository to get the goods. Here's the repo settings you're need:
<repositories>
<repository>
<id>appfuse</id>
<name>AppFuse Repository</name>
<url>http://static.appfuse.org/repository</url>
</repository>
<repository>
<id>struts-203-staging</id>
<name>Apache Struts 2.0.3 Staging Repository</name>
<url>http://people.apache.org/builds/struts/2.0.3/m2-staging-repository</url>
</repository>
</repositories>
Yeah, I could just advise you to use AppFuse 2.0 - but we're having a hard enough time supporting our existing users.
Posted in Java
at Jan 23 2007, 06:02:22 PM MST
6 Comments
Search This Site
Recent Entries
- Jack's Mohawk
- LinkedIn Cuts 10% (a.k.a. The Journey is Over)
- Happy Birthday Abbie!
- Moving from Spring's XML to Annotations in AppFuse
- Free Maven Training in New Orleans on Election Day
- AppFuse Light ยป AppFuse, Maven Archetypes and Shared Web Assets
- Great Weekend in Montana
- Colorado Software Summit 2008 Wrapup
- RESTful Web Applications with Subbu Allamaraju
- Core Animation with Bill Dudney
Posted by Robert on January 24, 2007 at 08:22 AM MST #
Posted by Nelz on January 24, 2007 at 08:52 AM MST #
Why? Because they have a dedicated team to develop and improving the web framework. If you ask the Spring team why Spring MVC is special, they'll likely respond that Spring Web Flow and DWR give them "Web 2.0" abilities. However, these two frameworks can be used with Struts 2 as well. I don't see Spring MVC losing momentum, I just see Struts 2 regaining the momentum that Struts 1 had.
Nelz - I've been knee deep in Maven 2 for almost a year now. The issue I'm speaking about here is probably as much of an Apache-ism as it is a Mavenism. When they did the release, the struts-annotations projects had a 1.0-SNAPSHOT version. When releasing, you shouldn't depend on an unreleased (SNAPSHOT) project.
Posted by Matt Raible on January 24, 2007 at 12:14 PM MST #
Posted by Thomas Ferris Nicolaisen on January 24, 2007 at 12:56 PM MST #
Posted by Matt Raible on January 24, 2007 at 01:03 PM MST #
Posted by Thomas Ferris Nicolaisen on January 24, 2007 at 01:10 PM MST #