Author: husted Date: Mon Jul 10 19:40:42 2006 New Revision: 420679 URL: http://svn.apache.org/viewvc?rev=420679&view=rev Log: =STR-2898 : Continue updates through scripting (but not apps).
Modified: struts/struts1/trunk/extras/src/site/xdoc/dispatchValidator.xml struts/struts1/trunk/scripting/src/site/xdoc/index.xml struts/struts1/trunk/scripting/src/site/xdoc/source-guide.xml struts/struts1/trunk/scripting/src/site/xdoc/user-guide.xml Modified: struts/struts1/trunk/extras/src/site/xdoc/dispatchValidator.xml URL: http://svn.apache.org/viewvc/struts/struts1/trunk/extras/src/site/xdoc/dispatchValidator.xml?rev=420679&r1=420678&r2=420679&view=diff ============================================================================== --- struts/struts1/trunk/extras/src/site/xdoc/dispatchValidator.xml (original) +++ struts/struts1/trunk/extras/src/site/xdoc/dispatchValidator.xml Mon Jul 10 19:40:42 2006 @@ -19,14 +19,13 @@ <document> <properties> - <title>Using the DispatchAction and Validator</title> + <title>Creating a Multipage Wizard with DispatchAction and Validator</title> </properties> <body> - <section name="Dispatching And Validating"> + <section name="Creating a Multipage Wizard with DispatchAction and Validator"> - <subsection name="Overview"> <p> This is simple example to illustrate how to build a @@ -42,7 +41,6 @@ form field validations. </p> - </subsection> <subsection name="Using the DispatchAction"> @@ -84,9 +82,11 @@ </action> ]]></source> + <p> The method <code>enterName</code> simply forwards to the first page. + </p> <source><![CDATA[ public ActionForward enterName(ActionMapping mapping, @@ -100,6 +100,7 @@ } ]]></source> + <p> On the page <code>name.jsp</code> is a hidden field for the @@ -112,15 +113,18 @@ Javascript to set the <code>submitName</code> parameter + </p> <source><![CDATA[ <html:submit onclick="this.form.submitName.value='enterAddress'"/> ]]></source> + <p> The <code>enterAddress</code> method then forwards to the address page. + </p> <source><![CDATA[ public ActionForward enterAddress(ActionMapping mapping, @@ -133,25 +137,31 @@ } ]]></source> + <p> On the <code>adddress.jsp</code> page, we again dynamically set the <code>submitName</code> parameter. + </p> <source><![CDATA[ <html:submit value="submit" onclick="this.form.submitName.value='submitAddress'"/> ]]></source> + <p> And the action path that is submitted is + </p> <source><![CDATA[ <html:form action="/address"> ]]></source> + <p> The action mapping for <code>/address</code> is + </p> <source><![CDATA[ <action path="/address" @@ -170,14 +180,17 @@ </action> ]]></source> + <p> Note that two action mappings are required to handle the page flow (we'll discuss why in the next section). + </p> </subsection> <subsection name="Validations"> + <p> Let's now add some validations to require input fields using the Validator. In validation.xml, there's a @@ -186,6 +199,7 @@ that specifies two field validations for the form bean named <code>acmeForm.</code> + </p> <source><![CDATA[ <formset> @@ -200,6 +214,7 @@ </formset> ]]></source> + <p> We need to identify the page where the input field resides so that we can control which validations are triggered for a given @@ -212,27 +227,34 @@ <code>acmeForm</code> (even validations for fields that the user has not seen yet). - + </p> + <p> On each of the pages, a hidden field is used to identify the page number. - + </p> + <p> In <code>name.jsp</code> + </p> <source><![CDATA[ <html:hidden property="page" value="1"/> ]]></source> + <p> In <code>address.jsp</code> + </p> <source><![CDATA[ <html:hidden property="page" value="2"/> ]]></source> + <p> The Validator will use the value of the page property in determining which validations to run. - + </p> + <p> Now let's revisit the reason for having two action mappings. An action mapping is required for each page since the @@ -241,25 +263,29 @@ to in case validation fails. Therefore we need to define an action mapping for each page that could be displayed after a validation fails. + </p> </subsection> <subsection name="Cancel and Previous"> + <p> The tricky part is how to setup Previous and Cancel buttons for each of the pages. If the user clicks Previous then the validations for the currrent page should not be triggered. For Cancel, none of the validations should be triggered. - + </p> + <p> The solution for Previous is to set the page number property to the number of the previous page, effectively circumventing the validations associated with the current page. + </p> <source><![CDATA[ <html:submit value="previous" onclick="this.form.submitName.value='previous'; this.form.page.value='1'"/> ]]></source> - + <p> For cancel, there are two options. We could use the Struts Taglib Cancel button or create an action specifically designed to @@ -267,7 +293,7 @@ a cancel request. The <code>cancel</code> action has no associated validations. - + </p> <source><![CDATA[ <action path="/cancel" @@ -279,16 +305,20 @@ </action> ]]></source> + <p> And the Cancel button submits to the <code>/cancel</code> action path. + </p> <source><![CDATA[ <html:submit value="cancel" onclick="this.form.action='/acme/cancel.do'"/> ]]></source> + <p> The full example is - <a href="dispatchValidator.zip">here,</a> + <a href="dispatchValidator.zip">available for download.</a> + </p> </subsection> Modified: struts/struts1/trunk/scripting/src/site/xdoc/index.xml URL: http://svn.apache.org/viewvc/struts/struts1/trunk/scripting/src/site/xdoc/index.xml?rev=420679&r1=420678&r2=420679&view=diff ============================================================================== --- struts/struts1/trunk/scripting/src/site/xdoc/index.xml (original) +++ struts/struts1/trunk/scripting/src/site/xdoc/index.xml Mon Jul 10 19:40:42 2006 @@ -24,7 +24,7 @@ <body> <section name="Struts Scripting"> <a name="overview"/> - <p>This project allows Struts Actions to be written in the scripting + <p>This component allows Struts Actions to be written in the scripting language of one's choice rather than as Java classes. It uses the <a href="http://jakarta.apache.org/bsf">Bean Scripting Framework</a> to allow scripts to be written in any language BSF supports like Perl, @@ -34,7 +34,7 @@ Struts Scripting allows an application to be developed rapidly with the quick development cycle (edit file -> refresh browser) that one would expect in a scripting environment. Furthermore, it enables other - non-Java trained members of a development grup, such as web designers who + non-Java trained members of a development group, such as web designers who may have a scripting background, to be more involved, leaving the Java developers to create the reusable services the Struts actions will interact with. Finally, when used with Java-like languages such as <a Modified: struts/struts1/trunk/scripting/src/site/xdoc/source-guide.xml URL: http://svn.apache.org/viewvc/struts/struts1/trunk/scripting/src/site/xdoc/source-guide.xml?rev=420679&r1=420678&r2=420679&view=diff ============================================================================== --- struts/struts1/trunk/scripting/src/site/xdoc/source-guide.xml (original) +++ struts/struts1/trunk/scripting/src/site/xdoc/source-guide.xml Mon Jul 10 19:40:42 2006 @@ -24,8 +24,8 @@ <body> <section name="Struts Scripting Source Code Guide"> <a name="overview"/> - <p>The Struts Scripting project, for the most part, follows Apache Struts build and - source code layout, so if you are familiar with another Struts project, you'll be + <p>The Struts Scripting component, for the most part, follows Apache Struts build and + source code layout, so if you are familiar with another Struts component, you'll be at home here. If not, this guide first walks you though what is where and why. Next, it gives help on how to build common artifacts. </p> @@ -39,34 +39,33 @@ </ul> <subsection name="Source code layout"> <a name="layout"/> - <p>When you unzip the latest release Struts Scripting or check it out from subversion - (more help on Subversion at the Struts <a href="http://struts.apache.org/downloads.html#Source_Code">source code</a>), you'll be staring at the following directory structure: + <p>When you unzip the latest release of Struts or check it out from Subversion + (more help on Subversion at the Struts <a href="http://struts.apache.org/downloads.html#Source_Code">source code</a>), you'll be confronted with a directory structure that includes: </p> <ul> - <li><code>/src</code> - All source code can be found here</li> - <li><code>/src/java</code> - The source code for the Struts Scripting framework itself</li> - <li><code>/src/struts-example</code> - A modified version of the Struts 1.2.8 Mailreader example application. - This version replaces Java-coded Struts Actions with <a href="http://groovy.codehaus.org">Groovy</a> scripts.</li> + <li><code>/apps/scripting-mailreader</code> - A modified version of the classic Struts Mailreader example application. + This rendition replaces Java-coded Struts Actions with <a href="http://groovy.codehaus.org">Groovy</a> scripts.</li> + <li><code>/scripting/src</code> - All other scripting source code can be found here</li> + <li><code>/scripting/src/main/java</code> - The source code for the Struts Scripting framework itself</li> </ul> <ul> - <li><code>/xdocs</code> - The XML source code for all documentation, including this guide.</li> - <li><code>/target</code> - Maven puts all compiled files into this temporary directory.</li> + <li><code>/scripting/src/site/xdocs</code> - The XML source code for all documentation, including this guide.</li> + <li><code>/scripting/target</code> - Maven puts all compiled files into this temporary directory.</li> </ul> - <p>Next, we'll look at how to build both Struts Scripting library and the included example application.</p> + <p>Next, we'll look at how to build both Struts Scripting library and the Mailreader example application.</p> </subsection> <subsection name="Build Instructions"> <a name="build"/> - <p>Struts Scripting uses <a href="http://maven.apache.org">Apache Maven</a> 1.0 to build its jar, example application, documentation, and distribution files. Maven 1.0 is used throughout Struts for building subprojects, providing a consistent build environment to Struts users. To follow these build instructions, you will need to have <a href="http://maven.apache.org">Apache Maven</a> 1.0 installed and its <code>maven</code> executable available in your command path. + <p>Struts Scripting uses <a href="http://maven.apache.org">Apache Maven 2</a> to build its JAR, example application, documentation, and distribution files. Maven is used throughout Struts for building subprojects, providing a consistent build environment to Struts users. To follow these build instructions, you will need to have <a href="http://maven.apache.org">Apache Maven 2</a> installed and its <code>mvn</code> executable available in your command path. </p> <p> Since there are a bunch of build targets, we will break the build down into tasks that you might want to accomplish and show the best way to complete them. </p> <ul> - <li><strong>Build the Struts Scripting jar</strong> - Run '<code>maven jar:jar</code>' which will create the jar as <code>/target/struts-scripting-VERSION.jar</code>.</li> - <li><strong>Build the Mailreader example</strong> - Run '<code>maven war:war</code>' to create <code>/target/struts-example.war</code>.</li> - <li><strong>Build the documentation</strong> - Run '<code>maven site:generate</code>' to create the Struts Scripting website at <code>/target/docs</code>.</li> + <li><strong>Build the Struts Scripting JAR</strong> - Run '<code>mvn jar:jar</code>' which will create the JAR as <code>/scripting/target/struts-scripting-VERSION.jar</code>.</li> + <li><strong>Build the Mailreader example</strong> - Change to <code>/apps/scripting-mailreader</code> and run '<code>mvn install</code>' to create <code>/apps/scripting-mailreadertarget/scripting-mailreader.war</code>.</li> + <li><strong>Build the documentation</strong> - Run '<code>mvn site</code>' to create the Struts Scripting website at <code>/scripting/target/docs</code>.</li> </ul> - <p>While this list only covers a few build targets, there are many other you can discover by typing '<code>maven -g</code>' from the Struts Scripting directory.</p> </subsection> </section> Modified: struts/struts1/trunk/scripting/src/site/xdoc/user-guide.xml URL: http://svn.apache.org/viewvc/struts/struts1/trunk/scripting/src/site/xdoc/user-guide.xml?rev=420679&r1=420678&r2=420679&view=diff ============================================================================== --- struts/struts1/trunk/scripting/src/site/xdoc/user-guide.xml (original) +++ struts/struts1/trunk/scripting/src/site/xdoc/user-guide.xml Mon Jul 10 19:40:42 2006 @@ -24,7 +24,7 @@ <body> <section name="Struts Scripting User Guide"> <a name="overview"/> - <p>The entire Struts Scripting project is only a few classes, since most of + <p>The entire Struts Scripting component is only a few classes, since most of the heavy lifting is done by the <a href="http://jakarta.apache.org/bsf">Bean Scripting Framework</a> and the scripting engines themselves. Therefore, there are only a few steps