Dashboard > Struts University > Home > Struts 2006 > Information > Page Comparison
Struts 2006
compared with
Current by Ted Husted
on Oct 22, 2005 07:42.

(show comment)
 
Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 23 changes. View first change.

 {info}To be presented at [ApacheCon US 2005|http://apachecon.com/] San Diego CA.{info}
  {info}To be presented at [ApacheCon US 2005|http://apachecon.com/] San Diego CA on Tuesday 13 December 2005 at 4:30p (TU20).{info}
  
h1. Struts 2006: An embarrassment of riches
  h1. Struts 2006: An Embarrassment of Riches
  
 Apache Struts is a hotbed of activity. Struts Classic 1.3, Struts Shale, Struts OverDrive, Struts Ti. Why so many frameworks? How are they different? Why are they all called Struts? Which is the best choice for my next project? In this session, we step back and look at Struts through a wide-angle lense.
  
 h2. Don Brown and Ted Husted
  
 h3. Members, Apache Struts PMC
  
 ----
  
 h2. Contents
  
 * The Tao of Struts
 * The Story so Far
 * The Upcoming 1.3 Release
 * Struts Core 1.3
 * Extends
 * Struts Classic 1.x Roadmap
 * New Project Organization
* Struts Shale
 * Shale Features
 * Struts Scripting
 * Struts Flow
* Struts Shale
 * Shale Features
 * Struts OverDrive
 * OverDrive Features
 * Struts Ti
 * Struts Dos Equis (2.x)
 * Final Thoughts
  
 ----
  
 h2. The Tao of Struts
  
 {code}
  "A newborn is soft and tender,
  A crone, hard and stiff.
  Plants and animals, in life, are supple and succulent;
  In death, withered and dry.
  So softness and tenderness are attributes of life,
  And hardness and stiffness, attributes of death."
  - Tao Te Ching; 76 Flexibility
  
 {code}
  
 {code}
  "The goal of the Apache Struts project
  is to encourage application architectures
  based on the "Model 2" approach,
  a variation of the classic
  Model-View-Controller (MVC) design paradigm.
  Under Model 2,
  a servlet (or equivalent) manages business logic execution,
  and presentation logic resides mainly in server pages."
 {code}
  
 ----
  
 h2. The Story So Far
  
* Struts 0.5 - May 2000 - Prototype release
 * Struts 1.0 - Jun 2001 - Initial release
 * Struts 1.1 - Jun 2003 - Commons release
 * Struts 1.2 - Dec 2004 - Wildcard release
 * Struts 1.3 - xxx 2006 - Subproject release
  * Struts 0.5 - May 2000 - *Prototype* release
 * Struts 1.0 - Jun 2001 - *Initial* release
 * Struts 1.1 - Jun 2003 - *Commons* release
 * Struts 1.2 - Dec 2004 - *Wildcard* release
 * Struts 1.3 - xxx 2006 - *Subproject* release
  
 ----
  
 h2. The Upcoming 1.3 Release
  
  * Divided project into subprojects
o Apps, Core, EL, Extras, Site, Taglibs, Tiles
 o Faces
 o Flow (new)
 o Scripting (new)
 o Shale (new)
  ** Apps, Core, EL, Extras, Site, Taglibs, Tiles
 ** Faces
 ** Scripting (new)
 ** Flow (new)
 ** Shale (new)
  * Subprojects are the "unit of release"
  * Seven subprojects from 1.2 are bundled as "Struts Classic"
  * Complete Maven build
  
 ----
  
 h2. Struts Core 1.3
  
  * Composable Request Processor (Commons Chain of Responsibility)
  * Arbitrary configuration properties
  * Command and Catalog elements.
  * "Extends" attribute
  * "isCommitted" Exception Handling
  * Postback Actions
  * Wildcard ActionConfig properties
  
 ----
  
 h2. Request Processor for 1.2
  
 {code}
  public void process(HttpServletRequest request,
  HttpServletResponse response)
  throws IOException, ServletException {
  
  processLocale(request, response);
  
  if (!processRoles(request, response, mapping)) {
  return;
  }
  
  /// ...
  
  ActionForward forward =
  processActionPerform(request, response,
  action, form, mapping);
  
  processForwardConfig(request, response, forward);
 }
 {code}
  
 h2. Composable Request Processor for 1.3
  
  
 {code}
  <chain name="process-action">
  
  <command
  className="org.apache.struts.chain.commands.servlet.SelectLocale"/>
  
  <command
  className="org.apache.struts.chain.commands.servlet.AuthorizeAction"/>
  
 <!-- ... -->
  
  <command
className="org.apache.struts.chain.commands.servlet.CreateAction"/>
  
  <command
  className="org.apache.struts.chain.commands.servlet.ExecuteAction"/>
  {code}
  
 ----
  
 h2. Arbitrary Configuration Attributes
  
 * Set an arbitary key/value pair to retrieve at runtime.
  
 {code}
  <action path="/EditSubscription"
  extends="Editor">
  <set-property key="foo" value="bar" />
  </action>
 {code}
  
 {code}
  public ActionForward execute(
  ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response)
  throws Exception {
  
  string foo = getProperty("foo");
  
  // ...
 {code}
  
 ----
  
 h2. Catalog and Command elements
  
  * *catalog* - The name of a commons-chain catalog in which to look up a command to be executed as part of servicing this request. Only meaningful if "command" is also specified.
  
  * *command* - The name of a commons-chain command which should be looked up and executed as part of servicing this request.
  
  * Available for both the Controller and any Action Mapping
  
 {code}
  <controller
pagePattern="$M$P"
  inputForward="true"
  catalog="Foo"
  command="FooBar"
  />
 {code}
  
 ----
  
 h2. "extends" attribute
  
  * "extends" available for <form-bean>, <exception>, <forward>, and <action>
  * Commons Validator added the "extends" attribute for the <form> element in 1.2
  
 {code}
 <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>
 {code}
  
 ----
  
 h2. "isCommitted" Exception Handling
  
 * ExceptionHandler tests response.isCommitted
 * If true, *includes* the configured view path, rather than forwarding to it.
 * Configurable property keys
  
 {code}
  <exception
  key="GlobalExceptionHandler.default"
  type="java.lang.Exception"
  path="/ErrorPage.jsp">
<set-property key="SILENT_IF_COMMITTED" value="true" />
 </exception>
   <set-property key="INCLUDE_PATH" value="/error.jsp" />
 </exception>
 {code}
  
 {code}
  <exception
  key="GlobalExceptionHandler.default"
  type="java.lang.Exception"
  path="/ErrorPage.jsp">
<set-property key="INCLUDE_PATH" value="/error.jsp" />
 </exception>
   <set-property key="SILENT_IF_COMMITTED" value="true" />
 </exception>
 {code}
  
 ----
  
 h2. PostBack Actions
  
 * The action attribute of the Form taglib is now optional.
 * If omitted, the original URI of the original request is used.
  
 {code}
 <html:form onsubmit="return validateLogonForm(this);">
 {code}
  
 ----
  
 h2. Wildcard ActionConfig properties
  
 * Wildcards 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" attibute.
  
 {code}
<action path="/Save*"
  command="Save{1}"
  catalog="{1}">
  <action path="/Save*"
  name="Save{1}"
  extends="BaseSave">
  <set-properties key="Save" value="{1}"/>
 </action>
 {code}
  
 ----
  
 h2. Struts Classic 1.x Roadmap
  
 h3. Struts Core 1.3 - Yet to come
  
* ActionCommand - A Commons Chain Command-like interface with one method: void Execute(ActionContext context)
  * ActionCommand
 ** ((void Execute(ActionContext context)}
  
* ActionContext - A Commons Chain Context that implements the Action class logical API (same signatures).
  * ActionContext
 ** A Commons Chain Context that implements the Action class logical API (same signatures).
  
* ViewContext - A Commons Chain Context that implements the combined VelocityStruts logical API (same signatures).
  * ViewContext
 ** A Commons Chain Context that implements the combined VelocityStruts logical API (same signatures).
  
 ----
  
 h2. Struts Classic 1.x Roadmap
  
 h3. Struts Core 1.4 thru 1.5
  
 Consider
* providing direct support for Portlets through an alternate Request Processor catalog.
 * combining DTDs.
 * refactoring for Spring.
  * Direct support for Portlets via an alternate catalog.
 * A consolidated DTD for Config, Tiles, Validator.
 * Refactoring with Spring.
  
 Consider
* a "smart" action type: executes Action class or ActionCommand interface, as given.
 * a "populate" method on ActionForm.
 * a "FormContext" mechanism.
  * A "smart" action type: executes Action class or ActionCommand interface, as given.
 * A "populate" method on ActionForm.
 * A "FormContext" mechanism.
  
 ----
  
 h2. New Project Organization
  
 h3. "Struts Classic"
  
* Apps - Example applications including Mail Reader
  * Apps - Example applications
  * Core - Controller and Validator
  * EL - The JSTL EL extended JSP taglibs
  * Extras - Optional Actions and Plugins
  * Site - The top-level Struts website
  * Taglibs - The original Struts JSP taglibs
  * Tiles - The Tiles templating framework
  
 h3. Building on Struts Classic
  
* Faces - Utilize Struts Actions via JSF components
  * Flow - Continuation-based process flow
  * Scripting - Scripted Actions using BSF
* Flow - Continuation-based process flow
  * Faces - Utilize Struts Actions via JSF components
  
 ----
  
 h2. New Project Organization (2)
  
 h3. New Directions, New Subprojects
  
* Shale - New framework built on JSF. More in a minute...
  * Shale - New framework built on JSF.
  * Tiles - A standalone Tiles release with no Struts dependencies
  
 h3. New Directions, New Whiteboards
  
  * Overdrive - Commons Chain-based business framework (C#, for now)
* Ti - Action-based MVC2 framework focusing on simplicity and Ruby on Rails-like development speed
  * Ti - Action-based MVC2 framework focusing on simplicity and development speed
  
 ----
  
 h2. Struts Shale
  
  * Web application framework based on Java Server Faces (JSF)
  * Created by Craig McClanahan, creator of Struts Core and Struts Taglibs, co-lead of the JSF spec
  * Like Struts Core, provides a "Front Controller" layer
* Shale has no dependencies on other Struts products
   * Shares zero code with Struts Classic
  * Shale is a first-class citzen of Apache Struts, like Struts Core
 * *Not* Struts 2.0 (More later)
  * *Not* Struts 2.0
  
 ----
  
 h2. Shale Features
  
 * View Controller - Convenient mechanism to associate a "backing" Java class with each JavaServer Faces view in an application, with predefined event handers for events significant to an application developer.
  
 * Dialog Manager - Mechanism to define a "conversation" with a user that requires multiple HTTP requests to implement, modeled as a state diagram.
  
 * Application Manager - Traditional application wide front controller features that should be applied to every request.
  
 * Reusable Views - An innovative sub-framework for supporting the configuration of reusable subtrees of JavaServer Faces components for customizable reuse.
  
 ----
  
 h2. Struts Scripting
  
 Implement Actions with JavaScript, BeanShell, Groovy, Jython, etc.
  
 {code}
  <action path="/logoff"
  type="org.apache.struts.bsf.ScriptAction"
  parameter="/WEB-INF/scripts/Logoff.bsh">
  <forward name="success" path="/index.jsp"/>
  </action>
 {code}
  
 ----
  
 h2. Struts Flow
  
 * Enables easy development of multi-page, server-side processes using Continuations-based JavaScript flows
  
 * Supports rapid development, and simplifies JavaScript-heavy projects by unifying client and server development models
  
 {code}
 function login() {
  while (struts.sessionScope["curUser"] == null) {
  forwardAndWait("loginForm", {"error" : error});
  user = struts.param["user"];
  passwd = struts.param["passwd"];
  if (userManager.login(user, passwd)) {
  struts.sessionScope["curUser"] = user;
  } else {
  error = "Invalid login, please try again";
  }
  }
 }
 {code}
  
 ----
  
 h2. Struts OverDrive
  
  * Business logic framework based on Commons Chain of Responsibility
  * Reduces complex business logic processing to a single command
  * Handles data conversion, formatting, validation, localization
  * Exposed to the presentation layer through a Helper object
  * Being developed with C# now, Java implementation expected to follow
  
 ----
  
 h2. OverDrive features
  
  * Catalog - Convenient mechanism to retrieve a Context and Command in one call
  * Processors - Convert, format, and validate input and output
  * Manifest - Configures the processors and messages for fields
  * Chains - Extensible pre-opt and post-opt chains wrap each request
  * Helpers- Handle commands and data transfer
  
 ----
  
 h2. Struts Ti
  
  * Exploring how to simplify development of MVC web applications
  * Prefers convention over configuration to minimize maintainence
  * Including features like annotations, automatic compiliation, and build-in Spring support
  * Stands on the shoulders of WebWork, Beehive, and Spring
  * Still in the design phase although working code is available
  
 ----
  
 h2. Struts Dos Equis (2.x)
  
 * Apache Struts is a set of products, each with it's own label and lifecycle
 * Struts Classic line is evolutionary not revolutionary
 ** Deprecate, Release, Remove
 * Will stay 1.x so long as backward compatiblity is maintained between releases
  
 ----
  
 h2. Final Thoughts
  
  * Apache Struts is both evolving and plunging ahead
  * Struts Classic will being actively developed and supported for a long time
  * Emerging frameworks, like Shale, OverDrive, and Ti, extend Apache Struts
  * Bottom line: use what works for you.
  
 http://struts.apache.org
  
 ----
Site running on a free Atlassian Confluence Open Source Project License granted to OSS. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.5 Build:#811 Jul 25, 2007) - Bug/feature request - Contact Administrators