Struts 2006 3
Struts 2006 3
An Embarrassment of Riches
processLocale(request, response);
if (!processRoles(request, response, mapping)) {
return;
}
/// ...
ActionForward forward =
processActionPerform(request, response,
action, form, mapping);
processForwardConfig(request, response, forward);
}
Composable Request Processor for 1.3
<chain name="process-action">
<command className= "...SelectLocale"/>
<command className= "...AuthorizeAction"/>
<!-- ... -->
<command className= "...CreateAction"/>
<command className= "...ExecuteAction"/>
</chain>
Arbitrary Configuration Attributes
<action path="/EditSubscription"
extends="Editor">
<set-property key="foo" value="bar"
/>
</action>
<controller
inputForward="true"
catalog="Foo"
command="FooBar"
/>
"extends" attribute
<struts-config>
<form-beans>
<form-bean name="registrationForm"
type="org.apache.struts.action.DynaValidatorForm">
<form-property name="firstName" type="java.lang.String" />
<form-property name="lastName" type="java.lang.String" />
</form-bean>
<form-bean name="managerRegistrationForm"
type="org.apache.struts.action.DynaValidatorForm"
extends="registrationForm">
<form-property name="department" type="java.lang.String"
/>
</form-bean>
</form-beans>
...
</struts-config>
"isCommitted" Exception Handling
<exception
key="GlobalExceptionHandler.default"
type="java.lang.Exception"
path="/ErrorPage.jsp">
<set-property key="INCLUDE_PATH"
value="/error.jsp" />
</exception>
<exception
key="GlobalExceptionHandler.default"
type="java.lang.Exception"
path="/ErrorPage.jsp">
<set-property key="SILENT_IF_COMMITTED"
value="true" />
</exception>
PostBack Actions
The action attribute of the Form taglib is now optional.
If omitted, the original URI of the original request is used.
<html:form
onsubmit="return validateLogonForm(this);">
Wildcard ActionConfig properties
Wildcards (introduced in 1.2) can now be used in the
properties of an ActionConfig.
This makes it easier to pass multiple request-time values to
the Action without complicating the "parameter" attribute.
<action path="/Save*"
name="Save{1}"
extends="BaseSave">
<set-properties key="Save" value="{1}"/>
</action>
New Project Organization
Struts Action Library
Action - Controller and Validator
Apps - Example applications
New Horizons
Shale – MVC2 framework based on JSF
OverDrive – C# framework for ASP.NET
<action path="/logoff"
type="org.apache.struts.bsf.ScriptAction"
parameter="/WEB-INF/scripts/Logoff.bsh">
}
}
Struts Shale
Web framework based on JSF
Created by Craig McClanahan
Provides a "Front Controller" layer
Like Struts Action
Shale and Action are both first-class
citizen of Apache Struts
One project, two frameworks
Struts OverDrive
Unofficial whiteboard proposal
Being developed with C# for ASP.NET
Apache Struts,
the leading web application framework for Java,
and Open Symphony WebWork,
a leader in technical innovation,
are working to merge their
communities and codebases.
The Story So Far
WebWork 1.0 – Mar 2002 – Initial release
WebWork 1.2 – Aug 2002 – OS release
WebWork 1.4 – Nov 2003
WebWork 2.0 – Feb 2004 – XWork release
WebWork 2.1 – Sep 2005
WebWork 2.2 – Dec 2005 (Beta 4)
WebWork joining Struts
October 2005
Java Web Alignment Group
November 2005
Mailing list announcements
December 2005
ApacheCon announcement
Migration
Well-paved migration paths
Tools
Examples
and others
Migration
Dual processors / Shared resources
*.do – Struts Action 1.x
*.action – Struts Action 2.x
Phase 2
Zero XML configuration
Annotated stateful POJO controllers