Author: husted Date: Tue Nov 22 12:54:45 2005 New Revision: 348247 URL: http://svn.apache.org/viewcvs?rev=348247&view=rev Log: Release notes - Add some coding examples.
Modified: struts/core/trunk/xdocs/userGuide/release-notes.xml Modified: struts/core/trunk/xdocs/userGuide/release-notes.xml URL: http://svn.apache.org/viewcvs/struts/core/trunk/xdocs/userGuide/release-notes.xml?rev=348247&r1=348246&r2=348247&view=diff ============================================================================== --- struts/core/trunk/xdocs/userGuide/release-notes.xml (original) +++ struts/core/trunk/xdocs/userGuide/release-notes.xml Tue Nov 22 12:54:45 2005 @@ -146,6 +146,22 @@ it was not easy to use multiple extension that each wanted to override the request processor in a different way. </p> + <source> +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); +} +</source> <p> For Struts 1.3, we turned the request processor methods into Commands that are part of a flexible Chain of Commands. @@ -155,6 +171,15 @@ to extend or streamline the request processing gauntlet to meets the needs of different kinds of applications. </p> +<source> +<chain name="process-action"> + <command className= "...SelectLocale"/> + <command className= "...AuthorizeAction"/> +<!-- ... --> + <command className= "...CreateAction"/> + <command className= "...ExecuteAction"/> +</chain> +</source> <p> We fully expect the Struts 1.3 request processor to be backwardly compatible with earlier versions. @@ -165,6 +190,7 @@ We've made a few other changes and improvements in Struts 1.3.x, but the two big-ticket items are subprojects and the new request processor. </p> + <h4>Arbitrary configuration properties</h4> <p> @@ -172,6 +198,22 @@ Arbitrary configuration properties let us externalize more of our configurations, encouraging reuse. </p> + +<source> +<action path="/EditSubscription" + extends="Editor"> + <set-property key="foo" value="bar" /> +</action> + +public ActionForward execute( + ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + string foo = getProperty("foo"); + // ... +</source> <p> Arbitrary Configuration should make it easier for everyone to write reusable chunks of code, for ActionMappings, Exception Handlers, @@ -202,7 +244,13 @@ command - The name of a commons-chain command which should be looked up and executed as part of servicing this request. </p> - +<source> +<controller + inputForward="true" + catalog="Foo" + command="FooBar" + /> +</source> <h4>Extends attribute</h4> <p> @@ -210,6 +258,24 @@ we can now use the <b>extends</b> attribute to adopt default settings from another element, as we already can in the Tiles configuration files. </p> +<source> +<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> +</source> <p> Extends makes using XML elements much more like object-orientated programming. You can setup a base element, and then only specify the behavior that changes. @@ -226,12 +292,32 @@ The updated ExceptionHandler accepts new configuration attributes which let you choose alternate behavior, or no behavior at all. See the JavaDoc for details. </p> + +<source> +<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> +</source> <h4>Postback Forms</h4> <p> The action attribute of the Form taglib is now optional. If omitted, the original URI of the original request is used. </p> +<source> +<html:form + onsubmit="return validateLogonForm(this);"> +</source> <h4>Wildcard ActionConfig properties</h4> <p> @@ -239,6 +325,14 @@ This makes it easier to pass multiple request-time values to the Action without complicating the "parameter" attibute. </p> + +<source> +<action path="/Save*" + name="Save{1}" + extends="BaseSave"> + <set-properties key="Save" value="{1}"/> +</action> +</source> <h3>Struts EL</h3> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]