You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by sr...@apache.org on 2005/09/17 07:56:25 UTC

svn commit: r289708 [1/4] - in /struts/apps/trunk/cookbook: ./ src/ src/java/ src/java/examples/ src/java/examples/bean/ src/java/examples/dyna/ src/java/examples/links/ src/java/examples/localization/ src/java/examples/logic/ src/java/examples/multibo...

Author: sraeburn
Date: Fri Sep 16 22:55:45 2005
New Revision: 289708

URL: http://svn.apache.org/viewcvs?rev=289708&view=rev
Log:
Added struts-cookbook sample application

Added:
    struts/apps/trunk/cookbook/   (with props)
    struts/apps/trunk/cookbook/maven.xml
    struts/apps/trunk/cookbook/project.xml
    struts/apps/trunk/cookbook/src/
    struts/apps/trunk/cookbook/src/java/
    struts/apps/trunk/cookbook/src/java/examples/
    struts/apps/trunk/cookbook/src/java/examples/MessageResources.properties   (with props)
    struts/apps/trunk/cookbook/src/java/examples/MessageResources_de.properties   (with props)
    struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_CA.properties   (with props)
    struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_GB.properties   (with props)
    struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_US.properties   (with props)
    struts/apps/trunk/cookbook/src/java/examples/MessageResources_es.properties   (with props)
    struts/apps/trunk/cookbook/src/java/examples/MessageResources_fr.properties   (with props)
    struts/apps/trunk/cookbook/src/java/examples/MessageResources_it.properties   (with props)
    struts/apps/trunk/cookbook/src/java/examples/MessageResources_pt.properties   (with props)
    struts/apps/trunk/cookbook/src/java/examples/SuccessAction.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/TestBean.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/bean/
    struts/apps/trunk/cookbook/src/java/examples/bean/ExampleBean.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/bean/NestedBean.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/bean/PrepareBeanAction.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/dyna/
    struts/apps/trunk/cookbook/src/java/examples/dyna/ProcessDynaAction.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/links/
    struts/apps/trunk/cookbook/src/java/examples/links/PrepareLinksAction.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/links/ProcessLinksAction.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/localization/
    struts/apps/trunk/cookbook/src/java/examples/localization/ProcessLocalizationAction.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/logic/
    struts/apps/trunk/cookbook/src/java/examples/logic/PrepareLogicAction.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/multibox/
    struts/apps/trunk/cookbook/src/java/examples/multibox/MultiboxActionForm.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/multibox/PrepareMultiboxAction.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/multibox/ProcessMultiboxAction.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/options/
    struts/apps/trunk/cookbook/src/java/examples/options/BookBean.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/options/PrepareOptionsAction.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/options/ProcessOptionsAction.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/simple/
    struts/apps/trunk/cookbook/src/java/examples/simple/ProcessSimpleAction.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/simple/SimpleActionForm.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/token/
    struts/apps/trunk/cookbook/src/java/examples/token/PrepareTokenAction.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/token/ProcessTokenAction.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/validator/
    struts/apps/trunk/cookbook/src/java/examples/validator/CustomValidator.java   (with props)
    struts/apps/trunk/cookbook/src/java/examples/validator/ProcessValidatorAction.java   (with props)
    struts/apps/trunk/cookbook/src/webapp/
    struts/apps/trunk/cookbook/src/webapp/WEB-INF/
    struts/apps/trunk/cookbook/src/webapp/WEB-INF/chain-config.xml   (with props)
    struts/apps/trunk/cookbook/src/webapp/WEB-INF/struts-config.xml   (with props)
    struts/apps/trunk/cookbook/src/webapp/WEB-INF/validation.xml   (with props)
    struts/apps/trunk/cookbook/src/webapp/WEB-INF/validator-rules.xml   (with props)
    struts/apps/trunk/cookbook/src/webapp/WEB-INF/web.xml   (with props)
    struts/apps/trunk/cookbook/src/webapp/css/
    struts/apps/trunk/cookbook/src/webapp/css/example.css   (with props)
    struts/apps/trunk/cookbook/src/webapp/images/
    struts/apps/trunk/cookbook/src/webapp/images/code.gif   (with props)
    struts/apps/trunk/cookbook/src/webapp/images/execute.gif   (with props)
    struts/apps/trunk/cookbook/src/webapp/images/jsp.gif   (with props)
    struts/apps/trunk/cookbook/src/webapp/images/return.gif   (with props)
    struts/apps/trunk/cookbook/src/webapp/images/valid-xhtml10.png   (with props)
    struts/apps/trunk/cookbook/src/webapp/index.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/
    struts/apps/trunk/cookbook/src/webapp/jsp/bean/
    struts/apps/trunk/cookbook/src/webapp/jsp/bean/Bean.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/bean/include.inc   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/bean/source.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/dyna/
    struts/apps/trunk/cookbook/src/webapp/jsp/dyna/Dyna.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/dyna/DynaResults.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/dyna/source.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/links/
    struts/apps/trunk/cookbook/src/webapp/jsp/links/Links.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/links/LinksResults.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/links/source.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/localization/
    struts/apps/trunk/cookbook/src/webapp/jsp/localization/Localization.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/localization/source.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/logic/
    struts/apps/trunk/cookbook/src/webapp/jsp/logic/Logic.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/logic/source.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/messages/
    struts/apps/trunk/cookbook/src/webapp/jsp/messages/Messages.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/messages/source.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/multibox/
    struts/apps/trunk/cookbook/src/webapp/jsp/multibox/Multibox.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/multibox/MultiboxResults.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/multibox/source.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/options/
    struts/apps/trunk/cookbook/src/webapp/jsp/options/Options.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/options/OptionsResults.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/options/source.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/simple/
    struts/apps/trunk/cookbook/src/webapp/jsp/simple/Simple.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/simple/SimpleResults.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/simple/source.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/token/
    struts/apps/trunk/cookbook/src/webapp/jsp/token/Token.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/token/TokenResults.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/token/source.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/validator/
    struts/apps/trunk/cookbook/src/webapp/jsp/validator/Validator.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/validator/ValidatorResults.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/jsp/validator/source.jsp   (with props)
    struts/apps/trunk/cookbook/src/webapp/source.jsp   (with props)

Propchange: struts/apps/trunk/cookbook/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Sep 16 22:55:45 2005
@@ -0,0 +1 @@
+target

Added: struts/apps/trunk/cookbook/maven.xml
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/maven.xml?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/maven.xml (added)
+++ struts/apps/trunk/cookbook/maven.xml Fri Sep 16 22:55:45 2005
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+
+<project>
+
+    <postGoal name="war:webapp">
+        <!-- Include the source code in the cookbook webapp -->
+        <attainGoal name="copy-webapp-src"/>
+    </postGoal>
+
+</project>

Added: struts/apps/trunk/cookbook/project.xml
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/project.xml?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/project.xml (added)
+++ struts/apps/trunk/cookbook/project.xml Fri Sep 16 22:55:45 2005
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+
+<project>
+  <extend>${basedir}/../project.xml</extend>
+  <id>struts-cookbook</id>
+  <name>Struts cookbook web application</name>
+  <package>example.*</package>
+
+  <description>Struts cookbook web application</description>
+  <shortDescription>Struts cookbook webapp</shortDescription>
+
+  <dependencies/>
+
+</project>

Added: struts/apps/trunk/cookbook/src/java/examples/MessageResources.properties
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/MessageResources.properties?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/MessageResources.properties (added)
+++ struts/apps/trunk/cookbook/src/java/examples/MessageResources.properties Fri Sep 16 22:55:45 2005
@@ -0,0 +1,69 @@
+# -- Standard Errors --
+errors.header=<ul>
+errors.prefix=<li class="error">
+errors.suffix=</li>
+errors.footer=</ul>
+
+# -- Struts Validator Error Messages --
+errors.required={0} is required.
+errors.minlength={0} can not be less than {1} characters.
+errors.maxlength={0} can not be greater than {1} characters.
+errors.invalid={0} is invalid.
+errors.byte={0} must be a byte.
+errors.short={0} must be a short.
+errors.integer={0} must be an integer.
+errors.long={0} must be a long.
+errors.float={0} must be a float.
+errors.double={0} must be a double.
+errors.date={0} is not a date.
+errors.range={0} is not in the range {1} through {2}.
+errors.creditcard={0} is an invalid credit card number.
+errors.email={0} is an invalid e-mail address.
+
+# -- other --
+errors.cancel=Operation cancelled.
+errors.detail={0}
+errors.general=The process did not complete. Details should follow.
+errors.token=Request could not be completed. Operation is not in sequence.
+errors.twofields=The '{0}' field must have the same value as the '{1}' field.
+errors.name.required=Name is required.
+errors.secret.required=Please tell me a secret (it doesn't have to be true).
+
+# -- formatting --
+format.date=M/d/yyyy h:mm a z
+format.currency=$#,##0.00;$(#,##0.00)
+
+# -- buttons --
+button.submit=Submit
+button.cancel=Cancel
+button.confirm=Confirm
+button.reset=Reset
+button.save=Save
+
+# -- messages --
+message.detail={0}
+message.example.simple=This is a simple message.
+message.example.replaceable=This is <strong>{0}</strong> message with <strong>{1}</strong> parameters.
+message.welcome=Welcome to the examples page.
+
+# -- prompts --
+prompt.name=Name
+prompt.secret=Secret phrase
+
+prompt.required=Required
+prompt.byte=Byte
+prompt.creditCard=Credit Card
+prompt.date=Date
+prompt.double=Double
+prompt.email=Email
+prompt.float=Float
+prompt.integer=Integer
+prompt.long=Long
+prompt.mask=Mask
+prompt.min=Min. Length
+prompt.max=Max. Length
+prompt.range=Range
+prompt.required=Required
+prompt.short=Short
+prompt.password=Password
+prompt.password2=Password confirmation
\ No newline at end of file

Propchange: struts/apps/trunk/cookbook/src/java/examples/MessageResources.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/MessageResources.properties
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/MessageResources_de.properties
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/MessageResources_de.properties?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/MessageResources_de.properties (added)
+++ struts/apps/trunk/cookbook/src/java/examples/MessageResources_de.properties Fri Sep 16 22:55:45 2005
@@ -0,0 +1,4 @@
+message.welcome=Willkommen zur Beispielseite.
+
+# -- formatting --
+format.currency=$#.##0,00;$(#.##0,00)
\ No newline at end of file

Propchange: struts/apps/trunk/cookbook/src/java/examples/MessageResources_de.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/MessageResources_de.properties
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_CA.properties
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_CA.properties?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_CA.properties (added)
+++ struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_CA.properties Fri Sep 16 22:55:45 2005
@@ -0,0 +1 @@
+message.welcome=Welcome to the examples page, eh!
\ No newline at end of file

Propchange: struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_CA.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_CA.properties
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_GB.properties
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_GB.properties?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_GB.properties (added)
+++ struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_GB.properties Fri Sep 16 22:55:45 2005
@@ -0,0 +1 @@
+message.welcome=Welcome to the examples page. Would you care for a cuppa?
\ No newline at end of file

Propchange: struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_GB.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_GB.properties
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_US.properties
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_US.properties?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_US.properties (added)
+++ struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_US.properties Fri Sep 16 22:55:45 2005
@@ -0,0 +1 @@
+message.welcome=Welcome to the examples page. Ya'all come back now.
\ No newline at end of file

Propchange: struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_US.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/MessageResources_en_US.properties
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/MessageResources_es.properties
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/MessageResources_es.properties?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/MessageResources_es.properties (added)
+++ struts/apps/trunk/cookbook/src/java/examples/MessageResources_es.properties Fri Sep 16 22:55:45 2005
@@ -0,0 +1,4 @@
+message.welcome=Recepción a la página de los ejemplos.
+
+# -- formatting --
+format.currency=$#.##0,00;$(#.##0,00)
\ No newline at end of file

Propchange: struts/apps/trunk/cookbook/src/java/examples/MessageResources_es.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/MessageResources_es.properties
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/MessageResources_fr.properties
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/MessageResources_fr.properties?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/MessageResources_fr.properties (added)
+++ struts/apps/trunk/cookbook/src/java/examples/MessageResources_fr.properties Fri Sep 16 22:55:45 2005
@@ -0,0 +1,4 @@
+message.welcome=Bienvenue à la page d'exemples.
+
+# -- formatting --
+format.currency=$#.##0,00;$(#.##0,00)
\ No newline at end of file

Propchange: struts/apps/trunk/cookbook/src/java/examples/MessageResources_fr.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/MessageResources_fr.properties
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/MessageResources_it.properties
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/MessageResources_it.properties?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/MessageResources_it.properties (added)
+++ struts/apps/trunk/cookbook/src/java/examples/MessageResources_it.properties Fri Sep 16 22:55:45 2005
@@ -0,0 +1,4 @@
+message.welcome=Benvenuto alla pagina di esempi.
+
+# -- formatting --
+format.currency=$#.##0,00;$(#.##0,00)
\ No newline at end of file

Propchange: struts/apps/trunk/cookbook/src/java/examples/MessageResources_it.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/MessageResources_it.properties
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/MessageResources_pt.properties
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/MessageResources_pt.properties?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/MessageResources_pt.properties (added)
+++ struts/apps/trunk/cookbook/src/java/examples/MessageResources_pt.properties Fri Sep 16 22:55:45 2005
@@ -0,0 +1,4 @@
+message.welcome=Boa vinda à página dos exemplos.
+
+# -- formatting --
+format.currency=$#.##0,00;$(#.##0,00)
\ No newline at end of file

Propchange: struts/apps/trunk/cookbook/src/java/examples/MessageResources_pt.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/MessageResources_pt.properties
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/SuccessAction.java
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/SuccessAction.java?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/SuccessAction.java (added)
+++ struts/apps/trunk/cookbook/src/java/examples/SuccessAction.java Fri Sep 16 22:55:45 2005
@@ -0,0 +1,97 @@
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package examples;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+/**
+ * <p>An Action that forwards control via a "success" ActionFoward.</p>
+ * 
+ * <p>A recommended strategy is that view pages should link only to Actions and 
+ * never directly to other views. In situations where the view does not require
+ * any preparation you can use a SuccessAction, specifying the view as an 
+ * ActionForward named "success" in your action mapping.</p>
+ * 
+ * <p>e.g. If you configure an ActionMapping in struts-config.xml like this:</p>
+ * 
+ * <pre>
+ *    &lt;action path="/prepareView" 
+ *            type="examples.SuccessAction"&gt;
+ *        &lt;forward name="success" path="/jsp/View.jsp"/&gt;
+ *    &lt/action&gt;
+ * </pre>
+ * 
+ * <p>You could create a link to the view (via the Action) as follows:</p>
+ * 
+ * <pre>
+ *     &lt;html:link action="/prepareView"&gt;Display 'view' page&lt;/html:link&gt;
+ * </pre>
+ * 
+ * <p>If you later change your application such that the view page requires some 
+ * initialization you can change a single ActionMapping definition in 
+ * struts-config.xml rather than lots of link definitions in many JSPs.</p>
+ * 
+ * @version $Rev$ $Date$
+ */
+public class SuccessAction extends Action {
+
+    // ------------------------------------------------------------ Constructors
+
+    /**
+     * Constructor for SuccessAction.
+     */
+    public SuccessAction() {
+        super();
+    }
+
+    // ---------------------------------------------------------- Action Methods
+
+    /**
+     * Returns the <code>ActionForward</code> named "success" if one is 
+     * configured or <code>null</code>if it cannot be found.
+     * 
+     * Searches first for a local forward, then a global forward.
+     *
+     * @param mapping The ActionMapping used to select this instance
+     * @param form The optional ActionForm bean for this request (if any)
+     * @param request The HTTP request we are processing
+     * @param response The HTTP response we are creating
+     *
+     * @exception Exception if mapping.findForward throws an Exception
+     * 
+     * @return the "success" ActionForward, or null if it cannot be found
+     */
+    public ActionForward execute(
+        ActionMapping mapping,
+        ActionForm form,
+        HttpServletRequest request,
+        HttpServletResponse response)
+        throws Exception {
+
+        return mapping.findForward("success");
+
+    }
+
+}

Propchange: struts/apps/trunk/cookbook/src/java/examples/SuccessAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/SuccessAction.java
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/TestBean.java
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/TestBean.java?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/TestBean.java (added)
+++ struts/apps/trunk/cookbook/src/java/examples/TestBean.java Fri Sep 16 22:55:45 2005
@@ -0,0 +1,196 @@
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package examples;
+
+import java.io.Serializable;
+
+
+/**
+ * An example bean for Bean Examples
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestBean implements Serializable {
+
+    // ------------------------------------------------------ Instance Variables
+
+    /** A boolean value */
+    private boolean booleanValue = false;
+
+    /** A double value */
+    private double doubleValue = 45213.451;
+
+    /** A float value */
+    private float floatValue = -123.582F;
+
+    /** An integer value */
+    private int intValue = 256;
+
+    /** A long integer value */
+    private long longValue = 1321546L;
+
+    /** A short integer value */
+    private short shortValue = 257;
+
+    /** A string value */
+    private String stringValue = "Hello, world!";
+
+    /** A dateValue value */
+    private java.util.Date dateValue = new java.util.Date();
+
+    // ------------------------------------------------------------ Constructors
+
+    /**
+     * Constructor for TestBean.
+     */
+    public TestBean() {
+        super();
+    }
+
+    // -------------------------------------------------------------- Properties
+
+    /**
+     * Returns the booleanValue.
+     * @return boolean
+     */
+    public boolean isBooleanValue() {
+        return booleanValue;
+    }
+
+    /**
+     * Returns the doubleValue.
+     * @return double
+     */
+    public double getDoubleValue() {
+        return doubleValue;
+    }
+
+    /**
+     * Returns the floatValue.
+     * @return float
+     */
+    public float getFloatValue() {
+        return floatValue;
+    }
+
+    /**
+     * Returns the intValue.
+     * @return int
+     */
+    public int getIntValue() {
+        return intValue;
+    }
+
+    /**
+     * Returns the longValue.
+     * @return long
+     */
+    public long getLongValue() {
+        return longValue;
+    }
+
+    /**
+     * Returns the shortValue.
+     * @return short
+     */
+    public short getShortValue() {
+        return shortValue;
+    }
+
+    /**
+     * Returns the stringValue.
+     * @return String
+     */
+    public String getStringValue() {
+        return stringValue;
+    }
+
+    /**
+     * Sets the booleanValue.
+     * @param booleanValue The booleanValue to set
+     */
+    public void setBooleanValue(boolean booleanValue) {
+        this.booleanValue = booleanValue;
+    }
+
+    /**
+     * Sets the doubleValue.
+     * @param doubleValue The doubleValue to set
+     */
+    public void setDoubleValue(double doubleValue) {
+        this.doubleValue = doubleValue;
+    }
+
+    /**
+     * Sets the floatValue.
+     * @param floatValue The floatValue to set
+     */
+    public void setFloatValue(float floatValue) {
+        this.floatValue = floatValue;
+    }
+
+    /**
+     * Sets the intValue.
+     * @param intValue The intValue to set
+     */
+    public void setIntValue(int intValue) {
+        this.intValue = intValue;
+    }
+
+    /**
+     * Sets the longValue.
+     * @param longValue The longValue to set
+     */
+    public void setLongValue(long longValue) {
+        this.longValue = longValue;
+    }
+
+    /**
+     * Sets the shortValue.
+     * @param shortValue The shortValue to set
+     */
+    public void setShortValue(short shortValue) {
+        this.shortValue = shortValue;
+    }
+
+    /**
+     * Sets the stringValue.
+     * @param stringValue The stringValue to set
+     */
+    public void setStringValue(String stringValue) {
+        this.stringValue = stringValue;
+    }
+
+    /**
+     * Returns the dateValue.
+     * @return java.util.Date
+     */
+    public java.util.Date getDateValue() {
+        return dateValue;
+    }
+
+    /**
+     * Sets the dateValue.
+     * @param date The date to set
+     */
+    public void setDateValue(java.util.Date date) {
+        this.dateValue = date;
+    }
+
+}

Propchange: struts/apps/trunk/cookbook/src/java/examples/TestBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/TestBean.java
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/bean/ExampleBean.java
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/bean/ExampleBean.java?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/bean/ExampleBean.java (added)
+++ struts/apps/trunk/cookbook/src/java/examples/bean/ExampleBean.java Fri Sep 16 22:55:45 2005
@@ -0,0 +1,276 @@
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package examples.bean;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * An example bean for Bean Examples
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExampleBean implements Serializable {
+
+    // ------------------------------------------------------ Instance Variables
+
+    /** A boolean value */
+    private boolean booleanValue = false;
+
+    /** A double value */
+    private double doubleValue = 45213.451;
+
+    /** A float value */
+    private float floatValue = -123.582F;
+
+    /** An integer value */
+    private int intValue = 256;
+
+    /** A long integer value */
+    private long longValue = 1321546L;
+
+    /** A short integer value */
+    private short shortValue = 257;
+
+    /** A string value */
+    private String stringValue = "Hello, world!";
+
+    /** A dateValue value */
+    private java.util.Date dateValue = new java.util.Date();
+
+    /** A list */
+    private List list = new ArrayList();
+
+    /** An array */
+    private String[] array = { "Red", "Green", "Blue", "Black", "Orange" };
+
+    /** A nested bean */
+    private NestedBean nested = null;
+
+    /** HTML formatted markup */
+    private String html =
+          "<p>This is a <strong>simple</strong> example of " 
+        + "<em>HTML</em> formatted text.</p>";
+
+    // ------------------------------------------------------------ Constructors
+
+    /**
+     * Constructor for TestBean.
+     */
+    public ExampleBean() {
+        super();
+    }
+
+
+    // -------------------------------------------------------------- Properties
+
+    /**
+     * Returns the booleanValue.
+     * @return boolean
+     */
+    public boolean isBooleanValue() {
+        return booleanValue;
+    }
+
+    /**
+     * Returns the doubleValue.
+     * @return double
+     */
+    public double getDoubleValue() {
+        return doubleValue;
+    }
+
+    /**
+     * Returns the floatValue.
+     * @return float
+     */
+    public float getFloatValue() {
+        return floatValue;
+    }
+
+    /**
+     * Returns the intValue.
+     * @return int
+     */
+    public int getIntValue() {
+        return intValue;
+    }
+
+    /**
+     * Returns the longValue.
+     * @return long
+     */
+    public long getLongValue() {
+        return longValue;
+    }
+
+    /**
+     * Returns the shortValue.
+     * @return short
+     */
+    public short getShortValue() {
+        return shortValue;
+    }
+
+    /**
+     * Returns the stringValue.
+     * @return String
+     */
+    public String getStringValue() {
+        return stringValue;
+    }
+
+    /**
+     * Sets the booleanValue.
+     * @param booleanValue The booleanValue to set
+     */
+    public void setBooleanValue(boolean booleanValue) {
+        this.booleanValue = booleanValue;
+    }
+
+    /**
+     * Sets the doubleValue.
+     * @param doubleValue The doubleValue to set
+     */
+    public void setDoubleValue(double doubleValue) {
+        this.doubleValue = doubleValue;
+    }
+
+    /**
+     * Sets the floatValue.
+     * @param floatValue The floatValue to set
+     */
+    public void setFloatValue(float floatValue) {
+        this.floatValue = floatValue;
+    }
+
+    /**
+     * Sets the intValue.
+     * @param intValue The intValue to set
+     */
+    public void setIntValue(int intValue) {
+        this.intValue = intValue;
+    }
+
+    /**
+     * Sets the longValue.
+     * @param longValue The longValue to set
+     */
+    public void setLongValue(long longValue) {
+        this.longValue = longValue;
+    }
+
+    /**
+     * Sets the shortValue.
+     * @param shortValue The shortValue to set
+     */
+    public void setShortValue(short shortValue) {
+        this.shortValue = shortValue;
+    }
+
+    /**
+     * Sets the stringValue.
+     * @param stringValue The stringValue to set
+     */
+    public void setStringValue(String stringValue) {
+        this.stringValue = stringValue;
+    }
+
+    /**
+     * Returns the list.
+     * @return List
+     */
+    public List getList() {
+        return list;
+    }
+
+    /**
+     * Sets the list.
+     * @param list The list to set
+     */
+    public void setList(List list) {
+        this.list = list;
+    }
+
+    /**
+     * Returns the nested.
+     * @return NestedBean
+     */
+    public NestedBean getNested() {
+        return nested;
+    }
+
+    /**
+     * Sets the nested.
+     * @param nested The nested to set
+     */
+    public void setNested(NestedBean nested) {
+        this.nested = nested;
+    }
+
+    /**
+     * Returns the dateValue.
+     * @return java.util.Date
+     */
+    public java.util.Date getDateValue() {
+        return dateValue;
+    }
+
+    /**
+     * Sets the dateValue.
+     * @param date The date to set
+     */
+    public void setDateValue(java.util.Date date) {
+        this.dateValue = date;
+    }
+
+    /**
+     * Returns the array.
+     * @return String[]
+     */
+    public String[] getArray() {
+        return array;
+    }
+
+    /**
+     * Sets the array.
+     * @param array The array to set
+     */
+    public void setArray(String[] array) {
+        this.array = array;
+    }
+
+    /**
+     * Returns the html.
+     * @return String
+     */
+    public String getHtml() {
+        return html;
+    }
+
+    /**
+     * Sets the html.
+     * @param html The html to set
+     */
+    public void setHtml(String html) {
+        this.html = html;
+    }
+
+}

Propchange: struts/apps/trunk/cookbook/src/java/examples/bean/ExampleBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/bean/ExampleBean.java
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/bean/NestedBean.java
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/bean/NestedBean.java?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/bean/NestedBean.java (added)
+++ struts/apps/trunk/cookbook/src/java/examples/bean/NestedBean.java Fri Sep 16 22:55:45 2005
@@ -0,0 +1,64 @@
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package examples.bean;
+
+import java.io.Serializable;
+
+
+/**
+ * Another Example Bean
+ *
+ * @version $Rev$ $Date$
+ */
+public class NestedBean implements Serializable {
+
+    // ------------------------------------------------------ Instance Variables
+    
+    /** A string value */
+    private String stringValue = "This is a string from NestedBean";
+    
+    // ------------------------------------------------------------ Constructors
+
+    /**
+     * Constructor for NestedBean.
+     */
+    public NestedBean() {
+        super();
+    }
+
+    // -------------------------------------------------------------- Properties
+
+
+    /**
+     * Returns the stringValue.
+     * @return String
+     */
+    public String getStringValue() {
+        return stringValue;
+    }
+
+    /**
+     * Sets the stringValue.
+     * @param stringValue The stringValue to set
+     */
+    public void setStringValue(String stringValue) {
+        this.stringValue = stringValue;
+    }
+
+ }

Propchange: struts/apps/trunk/cookbook/src/java/examples/bean/NestedBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/bean/NestedBean.java
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/bean/PrepareBeanAction.java
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/bean/PrepareBeanAction.java?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/bean/PrepareBeanAction.java (added)
+++ struts/apps/trunk/cookbook/src/java/examples/bean/PrepareBeanAction.java Fri Sep 16 22:55:45 2005
@@ -0,0 +1,86 @@
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package examples.bean;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+/**
+ * Perform any tasks and setup any data that 
+ * must be prepared before the form is displayed.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PrepareBeanAction extends Action {
+
+    // ------------------------------------------------------------ Constructors
+
+    /**
+     * Constructor for PrepareBeanAction.
+     */
+    public PrepareBeanAction() {
+        super();
+    }
+
+    // ---------------------------------------------------------- Action Methods
+
+    /**
+     * Process the request and return an <code>ActionForward</code> instance 
+     * describing where and how control should be forwarded, or 
+     * <code>null</code>if the response has already been completed.
+     *
+     * @param mapping The ActionMapping used to select this instance
+     * @param form The optional ActionForm bean for this request (if any)
+     * @param request The HTTP request we are processing
+     * @param response The HTTP response we are creating
+     *
+     * @exception Exception if an exception occurs
+     * 
+     * @return the ActionForward to forward control to
+     */
+    public ActionForward execute(
+        ActionMapping mapping,
+        ActionForm form,
+        HttpServletRequest request,
+        HttpServletResponse response)
+        throws Exception {
+
+        // Set-up an example bean
+        ExampleBean example = new ExampleBean();
+        example.getList().add("List entry #1");
+        example.getList().add("List entry #2");
+        example.getList().add("List entry #3");
+        example.getList().add("List entry #4");
+        
+        // Add a nested bean
+        example.setNested(new NestedBean());
+       
+        // Place the example bean in the request scope
+        request.setAttribute("example", example);
+
+        // Forward to the test page
+        return mapping.findForward("success");
+    }
+
+}

Propchange: struts/apps/trunk/cookbook/src/java/examples/bean/PrepareBeanAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/bean/PrepareBeanAction.java
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/dyna/ProcessDynaAction.java
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/dyna/ProcessDynaAction.java?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/dyna/ProcessDynaAction.java (added)
+++ struts/apps/trunk/cookbook/src/java/examples/dyna/ProcessDynaAction.java Fri Sep 16 22:55:45 2005
@@ -0,0 +1,78 @@
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package examples.dyna;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+/**
+ * Retrieve and process data from the submitted form 
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProcessDynaAction extends Action {
+
+    // ------------------------------------------------------------ Constructors
+
+    /**
+     * Constructor for ProcessOptionsAction.
+     */
+    public ProcessDynaAction() {
+        super();
+    }
+
+    // ---------------------------------------------------------- Action Methods
+
+    /**
+     * Process the request and return an <code>ActionForward</code> instance 
+     * describing where and how control should be forwarded, or 
+     * <code>null</code>if the response has already been completed.
+     *
+     * @param mapping The ActionMapping used to select this instance
+     * @param form The optional ActionForm bean for this request (if any)
+     * @param request The HTTP request we are processing
+     * @param response The HTTP response we are creating
+     *
+     * @exception Exception if the application logic throws an exception
+     * 
+     * @return the ActionForward for the next view
+     */
+    public ActionForward execute(
+        ActionMapping mapping,
+        ActionForm form,
+        HttpServletRequest request,
+        HttpServletResponse response)
+        throws Exception {
+
+        // If user pressed 'Cancel' button, 
+        // return to home page
+        if (isCancelled(request)) {
+            return mapping.findForward("home");
+        }
+
+        // Forward to result page
+        return mapping.findForward("success");
+    }
+
+}

Propchange: struts/apps/trunk/cookbook/src/java/examples/dyna/ProcessDynaAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/dyna/ProcessDynaAction.java
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/links/PrepareLinksAction.java
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/links/PrepareLinksAction.java?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/links/PrepareLinksAction.java (added)
+++ struts/apps/trunk/cookbook/src/java/examples/links/PrepareLinksAction.java Fri Sep 16 22:55:45 2005
@@ -0,0 +1,87 @@
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package examples.links;
+
+import java.util.HashMap;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+import examples.TestBean;
+
+/**
+ * Perform any tasks and setup any data that 
+ * must be prepared before the form is displayed.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PrepareLinksAction extends Action {
+
+    // ------------------------------------------------------------ Constructors
+
+    /**
+     * Constructor for PrepareOptionsAction.
+     */
+    public PrepareLinksAction() {
+        super();
+    }
+
+    // ---------------------------------------------------------- Action Methods
+
+    /**
+     * Process the request and return an <code>ActionForward</code> instance 
+     * describing where and how control should be forwarded, or 
+     * <code>null</code>if the response has already been completed.
+     *
+     * @param mapping The ActionMapping used to select this instance
+     * @param form The optional ActionForm bean for this request (if any)
+     * @param request The HTTP request we are processing
+     * @param response The HTTP response we are creating
+     *
+     * @exception Exception if an exception occurs
+     * 
+     * @return the ActionForward to forward control to
+     */
+    public ActionForward execute(
+        ActionMapping mapping,
+        ActionForm form,
+        HttpServletRequest request,
+        HttpServletResponse response)
+        throws Exception {
+
+        HashMap parms = new HashMap();
+        parms.put("color", "Red");
+        parms.put("fruit", "Apple");
+        parms.put("animal", "Rabbit");
+        request.setAttribute("parms", parms);
+        
+        TestBean bean = new TestBean();
+        request.setAttribute("testBean", bean);        
+        
+        // Just forward to the form - no preparation required
+        return mapping.findForward("success");
+
+    }
+
+}

Propchange: struts/apps/trunk/cookbook/src/java/examples/links/PrepareLinksAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/links/PrepareLinksAction.java
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/links/ProcessLinksAction.java
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/links/ProcessLinksAction.java?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/links/ProcessLinksAction.java (added)
+++ struts/apps/trunk/cookbook/src/java/examples/links/ProcessLinksAction.java Fri Sep 16 22:55:45 2005
@@ -0,0 +1,72 @@
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package examples.links;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+/**
+ * Retrieve and process data from the submitted form 
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProcessLinksAction extends Action {
+
+    // ------------------------------------------------------------ Constructors
+
+    /**
+     * Constructor for ProcessOptionsAction.
+     */
+    public ProcessLinksAction() {
+        super();
+    }
+
+    // ---------------------------------------------------------- Action Methods
+
+    /**
+     * Process the request and return an <code>ActionForward</code> instance 
+     * describing where and how control should be forwarded, or 
+     * <code>null</code>if the response has already been completed.
+     *
+     * @param mapping The ActionMapping used to select this instance
+     * @param form The optional ActionForm bean for this request (if any)
+     * @param request The HTTP request we are processing
+     * @param response The HTTP response we are creating
+     *
+     * @exception Exception if the application logic throws an exception
+     * 
+     * @return the ActionForward for the next view
+     */
+    public ActionForward execute(
+        ActionMapping mapping,
+        ActionForm form,
+        HttpServletRequest request,
+        HttpServletResponse response)
+        throws Exception {
+
+        // Forward to result page
+        return mapping.findForward("success");
+    }
+
+}

Propchange: struts/apps/trunk/cookbook/src/java/examples/links/ProcessLinksAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/links/ProcessLinksAction.java
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/localization/ProcessLocalizationAction.java
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/localization/ProcessLocalizationAction.java?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/localization/ProcessLocalizationAction.java (added)
+++ struts/apps/trunk/cookbook/src/java/examples/localization/ProcessLocalizationAction.java Fri Sep 16 22:55:45 2005
@@ -0,0 +1,97 @@
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package examples.localization;
+
+import java.util.Locale;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.struts.Globals;
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+/**
+ * Retrieve and process data from the submitted form 
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProcessLocalizationAction extends Action {
+
+    // ------------------------------------------------------------ Constructors
+
+    /**
+     * Constructor for ProcessOptionsAction.
+     */
+    public ProcessLocalizationAction() {
+        super();
+    }
+
+    // ---------------------------------------------------------- Action Methods
+
+    /**
+     * Process the request and return an <code>ActionForward</code> instance 
+     * describing where and how control should be forwarded, or 
+     * <code>null</code>if the response has already been completed.
+     *
+     * @param mapping The ActionMapping used to select this instance
+     * @param form The optional ActionForm bean for this request (if any)
+     * @param request The HTTP request we are processing
+     * @param response The HTTP response we are creating
+     *
+     * @exception Exception if the application logic throws an exception
+     * 
+     * @return the ActionForward for the next view
+     */
+    public ActionForward execute(
+        ActionMapping mapping,
+        ActionForm form,
+        HttpServletRequest request,
+        HttpServletResponse response)
+        throws Exception {
+
+        // Extract attributes we will need
+        HttpSession session = request.getSession();
+        
+        // Get locale from request, if any
+        Locale locale = request.getLocale();
+
+        // If supplied, set Locale based on request parameters; 
+        // country and language 
+        String language = request.getParameter("language");
+        String country = request.getParameter("country");
+
+        if ((language != null && language.length() > 0)
+            && (country != null && country.length() > 0)) {
+            locale = new java.util.Locale(language, country);
+        } else if (language != null && language.length() > 0) {
+            locale = new java.util.Locale(language, "");
+        } 
+        
+        //Save locale
+        session.setAttribute(Globals.LOCALE_KEY, locale);
+
+        // Forward to result page
+        return mapping.findForward("success");
+    }
+
+}

Propchange: struts/apps/trunk/cookbook/src/java/examples/localization/ProcessLocalizationAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/localization/ProcessLocalizationAction.java
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/logic/PrepareLogicAction.java
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/logic/PrepareLogicAction.java?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/logic/PrepareLogicAction.java (added)
+++ struts/apps/trunk/cookbook/src/java/examples/logic/PrepareLogicAction.java Fri Sep 16 22:55:45 2005
@@ -0,0 +1,123 @@
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package examples.logic;
+
+import java.util.ArrayList;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionErrors;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+
+import examples.TestBean;
+import examples.options.BookBean;
+
+/**
+ * Perform any tasks and setup any data that 
+ * must be prepared before the form is displayed.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PrepareLogicAction extends Action {
+
+    // ------------------------------------------------------------ Constructors
+
+    /**
+     * Constructor for PrepareOptionsAction.
+     */
+    public PrepareLogicAction() {
+        super();
+    }
+
+    // ---------------------------------------------------------- Action Methods
+
+    /**
+     * Process the request and return an <code>ActionForward</code> instance 
+     * describing where and how control should be forwarded, or 
+     * <code>null</code>if the response has already been completed.
+     *
+     * @param mapping The ActionMapping used to select this instance
+     * @param form The optional ActionForm bean for this request (if any)
+     * @param request The HTTP request we are processing
+     * @param response The HTTP response we are creating
+     *
+     * @exception Exception if an exception occurs
+     * 
+     * @return the ActionForward to forward control to
+     */
+    public ActionForward execute(
+        ActionMapping mapping,
+        ActionForm form,
+        HttpServletRequest request,
+        HttpServletResponse response)
+        throws Exception {
+
+        TestBean bean = new TestBean();
+        request.setAttribute("testBean", bean);
+
+        ArrayList items = new ArrayList();
+        request.setAttribute("items", items);
+
+        request.setAttribute("intValue", new Integer(7));
+        request.setAttribute("stringValue", "Hello, world!");
+
+        /* Collection of custom beans */
+        ArrayList books = new ArrayList();
+        books.add(new BookBean("0596003285", "Programming Jakarta Struts"));
+        books.add(new BookBean("1930110502", "Struts in Action"));
+        books.add(new BookBean("1861007817", "Professional Struts Applications"));
+        books.add(new BookBean("0672324725", "Struts Kick Start"));
+        books.add(new BookBean("0471213020", "Mastering Jakarta Struts"));
+        books.add(new BookBean("1558608621", "The Struts Framework"));
+        books.add(new BookBean("0971661901", "Struts Fast Track"));
+        request.setAttribute("books", books);
+
+        ActionErrors errors = new ActionErrors();
+        
+        errors.add(ActionMessages.GLOBAL_MESSAGE,
+            new ActionMessage("errors.detail", "This is a global error #1"));
+        errors.add(ActionMessages.GLOBAL_MESSAGE,
+            new ActionMessage("errors.detail", "This is a global error #2"));
+        errors.add("test",
+            new ActionMessage("errors.detail", "This is a test error"));
+
+        ActionMessages messages = new ActionMessages();
+        messages.add(ActionMessages.GLOBAL_MESSAGE,
+            new ActionMessage("message.detail", "This is global message #1"));
+        messages.add(ActionMessages.GLOBAL_MESSAGE,
+            new ActionMessage("message.detail", "This is global message #2"));
+        messages.add("test",
+            new ActionMessage("message.example.simple"));
+
+        
+        saveMessages(request, messages);
+        saveErrors(request, errors);
+        
+        // Forward to the form
+        return mapping.findForward("success");
+
+    }
+
+}

Propchange: struts/apps/trunk/cookbook/src/java/examples/logic/PrepareLogicAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/logic/PrepareLogicAction.java
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/multibox/MultiboxActionForm.java
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/multibox/MultiboxActionForm.java?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/multibox/MultiboxActionForm.java (added)
+++ struts/apps/trunk/cookbook/src/java/examples/multibox/MultiboxActionForm.java Fri Sep 16 22:55:45 2005
@@ -0,0 +1,131 @@
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package examples.multibox;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.struts.action.ActionErrors;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionMapping;
+
+/**
+ * An ActionForm for the Multibox examples
+ *
+ * @version $Rev$ $Date$
+ */
+public class MultiboxActionForm extends ActionForm {
+
+    // ------------------------------------------------------ Instance Variables
+
+    /** Fruits */
+    private String[] fruits = {};
+
+    /** Colors */
+    private String[] colors = {};
+
+    // ------------------------------------------------------------ Constructors
+
+    /**
+     * Constructor for MultiboxActionForm.
+     */
+    public MultiboxActionForm() {
+        super();
+    }
+
+    // ---------------------------------------------------------- Public Methods
+
+    /**
+     * Clear all checkboxes
+     *
+     * @param mapping The mapping used to select this instance
+     * @param request The servlet request we are processing
+     */
+    public void reset(ActionMapping mapping, HttpServletRequest request) {
+
+        /*
+         * The ActionForm reset method should only be used to *clear* 
+         * checkboxes. The correct place to *set* default checkbox values is in
+         * the 'prepare' action, called prior to displaying the form page.
+         */ 
+        String[] empty = {};
+        this.fruits = empty;
+        this.colors = empty;
+              
+    }
+
+    /**
+     * Validate the properties that have been set from this HTTP request,
+     * and return an <code>ActionMessages</code> object that encapsulates any
+     * validation errors that have been found.  If no errors are found, return
+     * <code>null</code> or an <code>ActionMessages</code> object with no
+     * recorded error messages.
+     *
+     * @param mapping The mapping used to select this instance
+     * @param request The servlet request we are processing
+     * 
+     * @return ActionMessages if any validation errors occurred
+     */
+    public ActionErrors validate(
+        ActionMapping mapping,
+        HttpServletRequest request) {
+        
+        /*
+         * We're not doing any validation (yet) so return null to 
+         * indicate that there were no errors. (We don't 
+         * actually need to override this nethod unles we're doing
+         * validation - but it's here for reference)
+         */
+        return null;
+    }
+
+    // -------------------------------------------------------------- Properties
+
+    /**
+     * Returns the colors.
+     * @return String[]
+     */
+    public String[] getColors() {
+        return colors;
+    }
+
+    /**
+     * Returns the fruits.
+     * @return String[]
+     */
+    public String[] getFruits() {
+        return fruits;
+    }
+
+    /**
+     * Sets the colors.
+     * @param colors The colors to set
+     */
+    public void setColors(String[] colors) {
+        this.colors = colors;
+    }
+
+    /**
+     * Sets the fruits.
+     * @param fruits The fruits to set
+     */
+    public void setFruits(String[] fruits) {
+        this.fruits = fruits;
+    }
+
+}

Propchange: struts/apps/trunk/cookbook/src/java/examples/multibox/MultiboxActionForm.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/multibox/MultiboxActionForm.java
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/multibox/PrepareMultiboxAction.java
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/multibox/PrepareMultiboxAction.java?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/multibox/PrepareMultiboxAction.java (added)
+++ struts/apps/trunk/cookbook/src/java/examples/multibox/PrepareMultiboxAction.java Fri Sep 16 22:55:45 2005
@@ -0,0 +1,93 @@
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package examples.multibox;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+/**
+ * Perform any tasks and setup any data that 
+ * must be prepared before the form is displayed.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PrepareMultiboxAction extends Action {
+
+    // ------------------------------------------------------------ Constructors
+
+    /**
+     * Constructor for PrepareOptionsAction.
+     */
+    public PrepareMultiboxAction() {
+        super();
+    }
+
+    // ---------------------------------------------------------- Action Methods
+
+    /**
+     * Process the request and return an <code>ActionForward</code> instance 
+     * describing where and how control should be forwarded, or 
+     * <code>null</code>if the response has already been completed.
+     *
+     * @param mapping The ActionMapping used to select this instance
+     * @param form The optional ActionForm bean for this request (if any)
+     * @param request The HTTP request we are processing
+     * @param response The HTTP response we are creating
+     *
+     * @exception Exception if an exception occurs
+     * 
+     * @return the ActionForward to forward control to
+     */
+    public ActionForward execute(
+        ActionMapping mapping,
+        ActionForm form,
+        HttpServletRequest request,
+        HttpServletResponse response)
+        throws Exception {
+
+        System.out.println("Prepare MultiboxActionForm ....");
+            
+        /* 
+         * Prepare a String array of color names used to generate 
+         * checkboxes using html:multibox tags in the JSP page.
+         */
+        String[] colors =
+            { "Red", "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet" };
+        request.setAttribute("colors", colors);
+    
+        /*
+         * Set default checkbox values. 
+         */ 
+        String[] defaultFruits = { "Orange", "Banana", "Apple" };
+        String[] defaultColors = { "Orange", "Yellow" };
+        MultiboxActionForm multiboxForm = (MultiboxActionForm) form;
+        multiboxForm.setFruits(defaultFruits);
+        multiboxForm.setColors(defaultColors);
+        
+        // Return an ActionForward to the form
+        return mapping.findForward("success");
+
+    }
+
+}

Propchange: struts/apps/trunk/cookbook/src/java/examples/multibox/PrepareMultiboxAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/multibox/PrepareMultiboxAction.java
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/multibox/ProcessMultiboxAction.java
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/multibox/ProcessMultiboxAction.java?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/multibox/ProcessMultiboxAction.java (added)
+++ struts/apps/trunk/cookbook/src/java/examples/multibox/ProcessMultiboxAction.java Fri Sep 16 22:55:45 2005
@@ -0,0 +1,78 @@
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package examples.multibox;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+/**
+ * Retrieve and process data from the submitted form 
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProcessMultiboxAction extends Action {
+
+    // ------------------------------------------------------------ Constructors
+
+    /**
+     * Constructor for ProcessOptionsAction.
+     */
+    public ProcessMultiboxAction() {
+        super();
+    }
+
+    // ---------------------------------------------------------- Action Methods
+
+    /**
+     * Process the request and return an <code>ActionForward</code> instance 
+     * describing where and how control should be forwarded, or 
+     * <code>null</code>if the response has already been completed.
+     *
+     * @param mapping The ActionMapping used to select this instance
+     * @param form The optional ActionForm bean for this request (if any)
+     * @param request The HTTP request we are processing
+     * @param response The HTTP response we are creating
+     *
+     * @exception Exception if the application logic throws an exception
+     * 
+     * @return the ActionForward for the next view
+     */
+    public ActionForward execute(
+        ActionMapping mapping,
+        ActionForm form,
+        HttpServletRequest request,
+        HttpServletResponse response)
+        throws Exception {
+
+        // If user pressed 'Cancel' button, 
+        // return to home page
+        if (isCancelled(request)) {
+            return mapping.findForward("home");
+        }
+
+        // Forward to result page
+        return mapping.findForward("success");
+    }
+
+}

Propchange: struts/apps/trunk/cookbook/src/java/examples/multibox/ProcessMultiboxAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/multibox/ProcessMultiboxAction.java
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/options/BookBean.java
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/options/BookBean.java?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/options/BookBean.java (added)
+++ struts/apps/trunk/cookbook/src/java/examples/options/BookBean.java Fri Sep 16 22:55:45 2005
@@ -0,0 +1,71 @@
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package examples.options;
+
+/**
+ * Represents a book
+ *
+ * @version $Rev$ $Date$
+ */
+public class BookBean {
+
+    // ------------------------------------------------------ Instance Variables
+    
+    /**
+     * International Standard Book Number (ISBN)
+     */
+    private String isbn;
+    
+    /**
+     * Book Title
+     */
+    private String title;
+
+    // ------------------------------------------------------------ Constructors
+
+    /**
+     * Constructor for BookBean.
+     * @param title the book title
+     * @param isbn the ISBN
+     */
+    public BookBean(String isbn, String title) {
+        this.isbn = isbn;
+        this.title = title;
+    }
+
+    // ------------------------------------------------------ Property Accessors
+
+    /**
+     * Returns the ISBN.
+     * @return the ISBN
+     */
+    public String getIsbn() {
+        return this.isbn;
+    }
+
+    /**
+     * Returns the book title
+     * @return the title
+     */
+    public String getTitle() {
+        return this.title;
+    }
+
+
+}

Propchange: struts/apps/trunk/cookbook/src/java/examples/options/BookBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/options/BookBean.java
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/options/PrepareOptionsAction.java
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/options/PrepareOptionsAction.java?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/options/PrepareOptionsAction.java (added)
+++ struts/apps/trunk/cookbook/src/java/examples/options/PrepareOptionsAction.java Fri Sep 16 22:55:45 2005
@@ -0,0 +1,162 @@
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package examples.options;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.util.LabelValueBean;
+
+/**
+ * Perform any tasks and setup any data that 
+ * must be prepared before the form is displayed.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PrepareOptionsAction extends Action {
+
+    // ------------------------------------------------------------ Constructors
+
+    /**
+     * Constructor for PrepareOptionsAction.
+     */
+    public PrepareOptionsAction() {
+        super();
+    }
+
+    // ---------------------------------------------------------- Action Methods
+
+    /**
+     * Process the request and return an <code>ActionForward</code> instance 
+     * describing where and how control should be forwarded, or 
+     * <code>null</code>if the response has already been completed.
+     *
+     * @param mapping The ActionMapping used to select this instance
+     * @param form The optional ActionForm bean for this request (if any)
+     * @param request The HTTP request we are processing
+     * @param response The HTTP response we are creating
+     *
+     * @exception Exception if an exception occurs
+     * 
+     * @return the ActionForward to forward control to
+     */
+    public ActionForward execute(
+        ActionMapping mapping,
+        ActionForm form,
+        HttpServletRequest request,
+        HttpServletResponse response)
+        throws Exception {
+
+        /* An array */
+        String[] fruits =
+            {
+                "Strawberry",
+                "Apple",
+                "Orange",
+                "Pear",
+                "Mango",
+                "Banana",
+                "Pineapple" };
+        request.setAttribute("fruits", fruits);
+
+        /* Two arrays - one for labels and one for values */
+        String[] colors =
+            { "Red", "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet" };
+        request.setAttribute("colors", colors);
+
+        String[] colorCodes =
+            {
+                "#FF0000",
+                "#FFA500",
+                "#FFFF00",
+                "#00FF00",
+                "#0000FF",
+                "#4B0082",
+                "#EE82EE" };
+        request.setAttribute("colorCodes", colorCodes);
+
+        /* A Collection */
+        ArrayList colorList = new ArrayList();
+        colorList.add("Red");
+        colorList.add("Orange");
+        colorList.add("Yellow");
+        colorList.add("Green");
+        colorList.add("Blue");
+        colorList.add("Indigo");
+        colorList.add("Violet");
+        request.setAttribute("colorCollection", colorList);
+
+        /* A Collection of LabelValue beans */
+        ArrayList days = new ArrayList();
+        days.add(new LabelValueBean("Monday", "1"));
+        days.add(new LabelValueBean("Tuesday", "2"));
+        days.add(new LabelValueBean("Wednesday", "3"));
+        days.add(new LabelValueBean("Thursday", "4"));
+        days.add(new LabelValueBean("Friday", "5"));
+        days.add(new LabelValueBean("Saturday", "6"));
+        days.add(new LabelValueBean("Sunday", "7"));
+        request.setAttribute("days", days);
+
+        /* Collection of custom beans */
+        ArrayList books = new ArrayList();
+        books.add(new BookBean("0596003285", "Programming Jakarta Struts"));
+        books.add(new BookBean("1930110502", "Struts in Action"));
+        books.add(
+            new BookBean("1861007817", "Professional Struts Applications"));
+        books.add(new BookBean("0672324725", "Struts Kick Start"));
+        books.add(new BookBean("0471213020", "Mastering Jakarta Struts"));
+        books.add(new BookBean("1558608621", "The Struts Framework"));
+        books.add(new BookBean("0971661901", "Struts Fast Track"));
+        request.setAttribute("books", books);
+
+        /* A Map 
+         * 
+         * Note: We are using a HashMap which is unsorted - the resulting 
+         * options could appear in any order. If you want to your options to be
+         * in a particular order you should you a SortedMap implementation such
+         * as the TreeMap. This behaviour is a feature of the standard Map 
+         * implementaions and nothing to to with Struts tags.
+         * 
+         * Also, we've used an Integer as the key to demonstrate that the 
+         * <html:options> and <html:optionsCollection> tags do not require 
+         * String values for the label and values. If they are passed an object
+         * other than a String, they will automatically call the toString() 
+         * method and use the result.
+         */
+        HashMap animals = new HashMap();
+        animals.put(new Integer(1), "Cat");
+        animals.put(new Integer(2), "Dog");
+        animals.put(new Integer(3), "Horse");
+        animals.put(new Integer(4), "Rabbit");
+        animals.put(new Integer(5), "Goldfish");
+        request.setAttribute("animals", animals);
+
+        // Forward to form page
+        return mapping.findForward("success");
+
+    }
+
+}

Propchange: struts/apps/trunk/cookbook/src/java/examples/options/PrepareOptionsAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/options/PrepareOptionsAction.java
------------------------------------------------------------------------------
    svn:keywords = date author id rev

Added: struts/apps/trunk/cookbook/src/java/examples/options/ProcessOptionsAction.java
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/java/examples/options/ProcessOptionsAction.java?rev=289708&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/java/examples/options/ProcessOptionsAction.java (added)
+++ struts/apps/trunk/cookbook/src/java/examples/options/ProcessOptionsAction.java Fri Sep 16 22:55:45 2005
@@ -0,0 +1,78 @@
+/*
+ * $Id$
+ *
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package examples.options;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+/**
+ * Retrieve and process data from the submitted form 
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProcessOptionsAction extends Action {
+
+    // ------------------------------------------------------------ Constructors
+
+    /**
+     * Constructor for ProcessOptionsAction.
+     */
+    public ProcessOptionsAction() {
+        super();
+    }
+
+    // ---------------------------------------------------------- Action Methods
+
+    /**
+     * Process the request and return an <code>ActionForward</code> instance 
+     * describing where and how control should be forwarded, or 
+     * <code>null</code>if the response has already been completed.
+     *
+     * @param mapping The ActionMapping used to select this instance
+     * @param form The optional ActionForm bean for this request (if any)
+     * @param request The HTTP request we are processing
+     * @param response The HTTP response we are creating
+     *
+     * @exception Exception if the application logic throws an exception
+     * 
+     * @return the ActionForward for the next view
+     */
+    public ActionForward execute(
+        ActionMapping mapping,
+        ActionForm form,
+        HttpServletRequest request,
+        HttpServletResponse response)
+        throws Exception {
+
+        // If user pressed 'Cancel' button, 
+        // return to home page
+        if (isCancelled(request)) {
+            return mapping.findForward("home");
+        }
+
+        // Forward to result page
+        return mapping.findForward("success");
+    }
+
+}

Propchange: struts/apps/trunk/cookbook/src/java/examples/options/ProcessOptionsAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/apps/trunk/cookbook/src/java/examples/options/ProcessOptionsAction.java
------------------------------------------------------------------------------
    svn:keywords = date author id rev



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org