struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject svn commit: r1009571 [2/3] - /websites/production/struts/content/getting-started/
Date Sun, 02 Apr 2017 09:12:56 GMT
Modified: websites/production/struts/content/getting-started/form-validation.html
==============================================================================
--- websites/production/struts/content/getting-started/form-validation.html (original)
+++ websites/production/struts/content/getting-started/form-validation.html Sun Apr  2 09:12:56 2017
@@ -123,7 +123,7 @@
   <section class="col-md-12">
     <h2 id="form-validation">Form Validation</h2>
 
-<p>This tutorial assumes you’ve completed the <em>Processing Forms</em>  tutorial and have a working form_processing project. The example code for this tutorial, form_validation, is available for checkout from the Struts 2 GitHub repository: <a href="https://github.com/apache/struts-examples">https://github.com/apache/struts-examples</a>.</p>
+<p>This tutorial assumes you’ve completed the <a href="processing-forms.html">Processing Forms</a> tutorial and have a working form_processing project. The example code for this tutorial, form_validation, is available for checkout from the Struts 2 GitHub repository: <a href="https://github.com/apache/struts-examples">https://github.com/apache/struts-examples</a>.</p>
 
 <blockquote>
 
@@ -133,20 +133,7 @@
 
 <p>In this tutorial we’ll explore using Struts 2 to validate the user’s input on a form. There are two ways you can use Struts 2 to do form validation. This tutorial will cover the more basic method, where the validation is included in the Struts 2 Action class.</p>
 
-<table>
-  <tbody>
-    <tr>
-      <td>The <a href="http://struts.apache.org/mail.html">Struts 2 user mailing list</a>^[http://struts.apache.org/mail.html] is an excellent place to get help. If you are having a problem getting the tutorial example applications to work search the Struts 2 mailing list. If you don’t find an answer to your problem, post a question on the mailing list.</td>
-    </tr>
-  </tbody>
-</table>
-
-<table>
-  <tbody>
-    <tr>
-    </tr>
-  </tbody>
-</table>
+<p>The <a href="http://struts.apache.org/mail.html">Struts 2 user mailing list</a> is an excellent place to get help. If you are having a problem getting the tutorial example applications to work search the Struts 2 mailing list. If you don’t find an answer to your problem, post a question on the mailing list.</p>
 
 <p><strong>Add validate Method</strong></p>
 
@@ -158,7 +145,7 @@
   <li>User younger then 18 cannot register</li>
 </ol>
 
-<p>If you recall from the <em>Processing Forms</em>  tutorial the user’s input into the form fields is placed by Struts 2 into the Java model class personBean. So a user’s input into the firstName field would end up as the value for personBean’s firstName instance field (via the personBean.setFirstName method).</p>
+<p>If you recall from the <a href="processing-forms.html">Processing Forms</a> tutorial the user’s input into the form fields is placed by Struts 2 into the Java model class personBean. So a user’s input into the firstName field would end up as the value for personBean’s firstName instance field (via the personBean.setFirstName method).</p>
 
 <p>In the validate method we can refer to get the values of personBean’s instance fields by using the appropriate get methods. Once we have the values we can employ logic to enforce our business rules.</p>
 
@@ -166,30 +153,19 @@
 
 <p><strong>validate method</strong></p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>	public void validate(){
-		
-		if ( personBean.getFirstName().length() == 0 ){	
-
-			addFieldError( "personBean.firstName", "First name is required." );
-			
-		}
-		
-				
-		if ( personBean.getEmail().length() == 0 ){	
-
-			addFieldError( "personBean.email", "Email is required." );
-			
-		}
-		
-		if ( personBean.getAge() &lt; 18 ){	
-
-			addFieldError( "personBean.age", "Age is required and must be 18 or older" );
-			
-		}
-		
-		
-	}
-
+<div class="highlighter-rouge"><pre class="highlight"><code>    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">validate</span><span class="p">(</span><span class="o">){</span>
+        <span class="k">if</span> <span class="o">(</span><span class="n">personBean</span><span class="o">.</span><span class="na">getFirstName</span><span class="o">().</span><span class="na">length</span><span class="o">()</span> <span class="o">==</span> <span class="mi">0</span><span class="o">)</span> <span class="o">{</span>
+            <span class="n">addFieldError</span><span class="o">(</span><span class="s">"personBean.firstName"</span><span class="o">,</span> <span class="s">"First name is required."</span><span class="o">);</span>
+        <span class="o">}</span>
+
+        <span class="k">if</span> <span class="o">(</span><span class="n">personBean</span><span class="o">.</span><span class="na">getEmail</span><span class="o">().</span><span class="na">length</span><span class="o">()</span> <span class="o">==</span> <span class="mi">0</span><span class="o">)</span> <span class="o">{</span>
+            <span class="n">addFieldError</span><span class="o">(</span><span class="s">"personBean.email"</span><span class="o">,</span> <span class="s">"Email is required."</span><span class="o">);</span>
+        <span class="o">}</span>
+
+        <span class="k">if</span> <span class="o">(</span><span class="n">personBean</span><span class="o">.</span><span class="na">getAge</span><span class="o">()</span> <span class="o">&lt;</span> <span class="mi">18</span><span class="o">)</span> <span class="o">{</span>
+            <span class="n">addFieldError</span><span class="o">(</span><span class="s">"personBean.age"</span><span class="o">,</span> <span class="s">"Age is required and must be 18 or older"</span><span class="o">);</span>
+        <span class="o">}</span>
+    <span class="o">}</span>
 </code></pre>
 </div>
 
@@ -203,8 +179,7 @@
 
 <p>To handle the return value of “input” we need to add the following result to our action node in struts.xml.</p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>&lt;result name="input"&gt;/register.jsp&lt;/result&gt;
-
+<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt">&lt;result</span> <span class="na">name=</span><span class="s">"input"</span><span class="nt">&gt;</span>/register.jsp<span class="nt">&lt;/result&gt;</span>
 </code></pre>
 </div>
 
@@ -216,14 +191,13 @@
 
 <p>So the following addFieldError method call:</p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>addFieldError( "personBean.firstName", "First name is required.")
-
+<div class="highlighter-rouge"><pre class="highlight"><code>    <span class="n">addFieldError</span><span class="o">(</span><span class="s">"personBean.firstName"</span><span class="o">,</span> <span class="s">"First name is required."</span><span class="o">)</span>
 </code></pre>
 </div>
 
 <p>will cause the message “First name is required” to be displayed above the firstName field on the form.</p>
 
-<p>If you have made the above changes to the <em>Processing Forms</em>  tutorial or you have downloaded from <a href="http://code.google.com/p/struts2-examples/downloads/list">Google Code</a>^[http://code.google.com/p/struts2-examples/downloads/list] either the Form_Validation_Struts2_Ant or Form_Validation_Struts2_Mvn projects run the application (see the README.txt in the project root folder). Click on the Please register link. On the registration form, just click the submit button and you should see:</p>
+<p>If you have made the above changes to the <em>Processing Forms</em>  tutorial or you have downloaded from <a href="http://code.google.com/p/struts2-examples/downloads/list">Google Code</a> either the Form_Validation_Struts2_Ant or Form_Validation_Struts2_Mvn projects run the application (see the README.txt in the project root folder). Click on the Please register link. On the registration form, just click the submit button and you should see:</p>
 
 <p><img src="attachments/att14975003_form_errors.png" alt="form_errors.png" /></p>
 
@@ -231,23 +205,13 @@
 
 <p><strong>Styling The Error Messages</strong></p>
 
-<p>The Struts 2 s:head tag can be used to provide CSS that includes a style for the error message. Add</p>
-
-<div class="highlighter-rouge"><pre class="highlight"><code>&lt;s:head /&gt;
-</code></pre>
-</div>
-<p>to register.jsp before the closing HTML</p>
-
-<div class="highlighter-rouge"><pre class="highlight"><code>&lt;/head&gt;
-</code></pre>
-</div>
-<p>tag. Go through the same steps as above and you should see:</p>
+<p>The Struts 2 s:head tag can be used to provide CSS that includes a style for the error message. Add <code class="highlighter-rouge">&lt;s:head /&gt;</code> to register.jsp before the closing HTML <code class="highlighter-rouge">&lt;/head&gt;</code> tag. Go through the same steps as above and you should see:</p>
 
 <p><img src="attachments/att14975001_form_errors_styled.png" alt="form_errors_styled.png" /></p>
 
 <p><strong>Summary</strong></p>
 
-<p>This tutorial covered validating a user’s form input by adding a validate method to an Action class. There is another more sophisticated way to validate user input using XML. If you want to learn more about using XML for validation in Struts 2 see <em>Validation</em> .</p>
+<p>This tutorial covered validating a user’s form input by adding a validate method to an Action class. There is another more sophisticated way to validate user input using XML. If you want to learn more about using XML for validation in Struts 2 see <a href="//struts.apache.org/docs/validation.html">Validation</a> .</p>
 
 <p><strong>Up Next</strong></p>
 

Modified: websites/production/struts/content/getting-started/message-resource-files.html
==============================================================================
--- websites/production/struts/content/getting-started/message-resource-files.html (original)
+++ websites/production/struts/content/getting-started/message-resource-files.html Sun Apr  2 09:12:56 2017
@@ -123,40 +123,21 @@
   <section class="col-md-12">
     <h2 id="message-resource-files">Message Resource Files</h2>
 
-<p>This tutorial assumes you’ve completed the <em>Form Validation</em>  tutorial and have a working form_validation project. The example code for this tutorial, message_resource, is available for checkout from the</p>
+<p>This tutorial assumes you’ve completed the <a href="form-validation.html">Form Validation</a> tutorial and have a working form_validation project. The example code for this tutorial, message_resource, is available for checkout from the</p>
 
-<blockquote>
-  <p>Struts 2 GitHub repository at <a href="https://github.com/apache/struts-examples">https://github.com/apache/struts-examples</a>.</p>
-</blockquote>
-
-<blockquote>
-
-</blockquote>
+<p>Struts 2 GitHub repository at <a href="https://github.com/apache/struts-examples">https://github.com/apache/struts-examples</a>.</p>
 
 <p><strong>Introduction</strong></p>
 
 <p>In this tutorial we’ll explore using Struts 2 message resource capabilities (also called resource bundles). Message resources provide a simple way to put text in a view page that is the same through out your application, to create form field labels, and to change text to a specific language based on the user’s locale (i18n).</p>
 
-<table>
-  <tbody>
-    <tr>
-      <td>The <a href="http://struts.apache.org/mail.html">Struts 2 user mailing list</a>^[http://struts.apache.org/mail.html] is an excellent place to get help. If you are having a problem getting the tutorial example applications to work search the Struts 2 mailing list. If you don’t find an answer to your problem, post a question on the mailing list.</td>
-    </tr>
-  </tbody>
-</table>
-
-<table>
-  <tbody>
-    <tr>
-    </tr>
-  </tbody>
-</table>
+<p>The <a href="http://struts.apache.org/mail.html">Struts 2 user mailing list</a> is an excellent place to get help. If you are having a problem getting the tutorial example applications to work search the Struts 2 mailing list. If you don’t find an answer to your problem, post a question on the mailing list.</p>
 
 <p><strong>Message Resource Property Files</strong></p>
 
 <p>In a Struts 2 web application you may associate a message resource property file with each Struts 2 Action class by creating a properties file with the same name as the Action class and having the .properties extension. This properties file must go in the same package as the Action class. For our tutorial example, let’s say we want to place the form field labels into a separate file where we can easily change them and also provide the capability to display the labels in other languages.</p>
 
-<p>If you’re doing this tutorial after completing <em>Form Validation</em>  then you can make these changes to that tutorial’s example application.</p>
+<p>If you’re doing this tutorial after completing <a href="form-validation.html">Form Validation</a> then you can make these changes to that tutorial’s example application.</p>
 
 <p>Put the text below in a file named Register.properties in the org.apache.struts.register.action package in the src/resources/java folder.</p>
 
@@ -167,7 +148,6 @@ personBean.lastName=Last name
 personBean.age=Age
 personBean.email=Email
 thankyou=Thank you for registering %{personBean.firstName}.
-
 </code></pre>
 </div>
 
@@ -175,14 +155,13 @@ thankyou=Thank you for registering %{per
 
 <p><strong>Struts 2 Key Attribute</strong></p>
 
-<p>The Struts 2 key attribute can be used in the <em>textfield</em>  tag to instruct the framework what value to use for the textfield’s name and label attributes. Instead of providing those attributes and their values directly, you can just use the key attribute.</p>
+<p>The Struts 2 key attribute can be used in the <a href="//struts.apache.org/docs/textfield.html">textfield</a> tag to instruct the framework what value to use for the textfield’s name and label attributes. Instead of providing those attributes and their values directly, you can just use the key attribute.</p>
 
-<p>If you open register.jsp from the <em>Form Validation</em>  tutorial you’ll see this Struts 2 textfield tag:</p>
+<p>If you open register.jsp from the <a href="form-validation.html">Form Validation</a> tutorial you’ll see this Struts 2 textfield tag:</p>
 
 <p><strong>textfield tag</strong></p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>&lt;s:textfield name="personBean.firstName" label="First name" /&gt;
-
+<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt">&lt;s:textfield</span> <span class="na">name=</span><span class="s">"personBean.firstName"</span> <span class="na">label=</span><span class="s">"First name"</span> <span class="nt">/&gt;</span>
 </code></pre>
 </div>
 
@@ -190,19 +169,17 @@ thankyou=Thank you for registering %{per
 
 <p><strong>textfield tag with key attribute</strong></p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>&lt;s:textfield key="personBean.firstName"  /&gt;
-
+<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt">&lt;s:textfield</span> <span class="na">key=</span><span class="s">"personBean.firstName"</span>  <span class="nt">/&gt;</span>
 </code></pre>
 </div>
 
 <p>The value for the key attribute instructs the Struts 2 framework to use the same value for the name attribute (personBean.firstName). For the label attribute’s value the value of the key attribute is used by the Struts 2 framework to find a key in a properties file with the same value. So in our example, Struts 2 will look in Register.properties for a key with a value of personBean.firstName. The value of that key (First name) will be used as the label attribute’s value.</p>
 
-<p>To enable the key attribute to find the properties file, the display of the view page must be the result of executing a Struts 2 Action class. Right now if you examine index.jsp from the <em>Form Validation</em>  tutorial the link to the register.jsp page is a standard URL.</p>
+<p>To enable the key attribute to find the properties file, the display of the view page must be the result of executing a Struts 2 Action class. Right now if you examine index.jsp from the <a href="form-validation.html">Form Validation</a> tutorial the link to the register.jsp page is a standard URL.</p>
 
 <p><strong>link to register.jsp</strong></p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>&lt;p&gt;&lt;a href="register.jsp"&gt;Please register&lt;/a&gt; for our prize drawing.&lt;/p&gt;
-
+<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt">&lt;p&gt;&lt;a</span> <span class="na">href=</span><span class="s">"register.jsp"</span><span class="nt">&gt;</span>Please register<span class="nt">&lt;/a&gt;</span> for our prize drawing.<span class="nt">&lt;/p&gt;</span>
 </code></pre>
 </div>
 
@@ -210,9 +187,8 @@ thankyou=Thank you for registering %{per
 
 <p><strong>link to Register Action class</strong></p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>&lt;s:url action="registerInput" var="registerInputLink" /&gt;
-&lt;p&gt;&lt;a href="${registerInputLink}"&gt;Please register&lt;/a&gt; for our prize drawing.&lt;/p&gt;
-
+<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt">&lt;s:url</span> <span class="na">action=</span><span class="s">"registerInput"</span> <span class="na">var=</span><span class="s">"registerInputLink"</span> <span class="nt">/&gt;</span>
+<span class="nt">&lt;p&gt;&lt;a</span> <span class="na">href=</span><span class="s">"${registerInputLink}"</span><span class="nt">&gt;</span>Please register<span class="nt">&lt;/a&gt;</span> for our prize drawing.<span class="nt">&lt;/p&gt;</span>
 </code></pre>
 </div>
 
@@ -220,22 +196,21 @@ thankyou=Thank you for registering %{per
 
 <p><strong>registerInput action node for struts.xml</strong></p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>&lt;action name="registerInput" class="org.apache.struts.register.action.Register" method="input" &gt;
-	&lt;result name="input"&gt;/register.jsp&lt;/result&gt;
-&lt;/action&gt;
-
+<div class="highlighter-rouge"><pre class="highlight"><code>    <span class="nt">&lt;action</span> <span class="na">name=</span><span class="s">"registerInput"</span> <span class="na">class=</span><span class="s">"org.apache.struts.register.action.Register"</span> <span class="na">method=</span><span class="s">"input"</span> <span class="nt">&gt;</span>
+        <span class="nt">&lt;result</span> <span class="na">name=</span><span class="s">"input"</span><span class="nt">&gt;</span>/register.jsp<span class="nt">&lt;/result&gt;</span>
+    <span class="nt">&lt;/action&gt;</span>
 </code></pre>
 </div>
 
 <p>The above action node instructs the Struts 2 framework to execute class Register’s input method in response to action registerInput. The input method is inherited by class Register from class ActionSupport. The default behavior of the inherited input method is to return the String input. The result node above specifies that if the returned result is “input” then render the view register.jsp.</p>
 
-<p>By doing the above the view page register.jsp will have access to the properties defined in Register.properties. The Struts 2 framework will make those properties defined in Register.properties available to the view page since the view page was rendered after Register.java (the Struts 2 Action class) was executed.</p>
+<p>By doing the above the view page register.jsp will have access to the properties defined in <code class="highlighter-rouge">Register.properties</code>. The Struts 2 framework will make those properties defined in <code class="highlighter-rouge">Register.properties</code> available to the view page since the view page was rendered after Register.java (the Struts 2 Action class) was executed.</p>
 
 <p>Follow the instructions (README.txt) in the project to create the war file and copy the war file to your servlet container. Open a web browser and navigate to the home page specified in the README.txt file (index.action). You should see a link to registerInput.action when mousing over the hyperlink Please Register.</p>
 
 <p><img src="attachments/att14975007_registerInput.png" alt="registerInput.png" /></p>
 
-<p>When you click on the Please Register link your browser should display the register.jsp. The form field labels should be the key values from the Register.properties file.</p>
+<p>When you click on the Please Register link your browser should display the register.jsp. The form field labels should be the key values from the <code class="highlighter-rouge">Register.properties</code> file.</p>
 
 <p><img src="attachments/att14975006_register.png" alt="register.png" /></p>
 
@@ -245,8 +220,7 @@ thankyou=Thank you for registering %{per
 
 <p><strong>text tag</strong></p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>&lt;h3&gt;&lt;s:text name="thankyou" /&gt;&lt;/h3&gt;
-
+<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt">&lt;h3&gt;&lt;s:text</span> <span class="na">name=</span><span class="s">"thankyou"</span> <span class="nt">/&gt;&lt;/h3&gt;</span>
 </code></pre>
 </div>
 
@@ -259,11 +233,10 @@ thankyou=Thank you for registering %{per
 <p><strong>Register.properties</strong></p>
 
 <div class="highlighter-rouge"><pre class="highlight"><code>thankyou=Thank you for registering %{personBean.firstName}.
-
 </code></pre>
 </div>
 
-<p>The markup %{personBean.firstName} tells Struts 2 to replace this part with the result of calling getPersonBean, which returns a Person object. Then call the getFirstName method which returns a String (the value the user inputted into the personBean.firstName form field on register.jsp).</p>
+<p>The markup <code class="highlighter-rouge">%{personBean.firstName}</code> tells Struts 2 to replace this part with the result of calling getPersonBean, which returns a Person object. Then call the getFirstName method which returns a String (the value the user inputted into the personBean.firstName form field on register.jsp).</p>
 
 <p><strong>Package Level Properties</strong></p>
 
@@ -274,7 +247,6 @@ thankyou=Thank you for registering %{per
 <p><strong>package.properties</strong></p>
 
 <div class="highlighter-rouge"><pre class="highlight"><code>greeting=Welcome to The Wonderful World of Struts 2
-
 </code></pre>
 </div>
 
@@ -282,8 +254,7 @@ thankyou=Thank you for registering %{per
 
 <p><strong>Using properties set in package.properties</strong></p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>&lt;h1&gt;&lt;s:text name="greeting" /&gt;&lt;/h1&gt;
-
+<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt">&lt;h1&gt;&lt;s:text</span> <span class="na">name=</span><span class="s">"greeting"</span> <span class="nt">/&gt;&lt;/h1&gt;</span>
 </code></pre>
 </div>
 
@@ -295,14 +266,13 @@ thankyou=Thank you for registering %{per
 
 <p><strong>Global Properties</strong></p>
 
-<p>You can also specify a global property file in struts.xml. The keys and values defined in that property file will be available to all the view pages that are rendered after executing an Action class.</p>
+<p>You can also specify a global property file in <code class="highlighter-rouge">struts.xml</code>. The keys and values defined in that property file will be available to all the view pages that are rendered after executing an Action class.</p>
 
-<p>Add the following to a file named global.properties (note the name doesn’t have to be global).</p>
+<p>Add the following to a file named <code class="highlighter-rouge">global.properties</code> (note the name doesn’t have to be global).</p>
 
 <p><strong>global.properties</strong></p>
 
 <div class="highlighter-rouge"><pre class="highlight"><code>contact=For assistance contact &lt;a href='mailto:contact@email.com'&gt;contact@email.com&lt;/a&gt;
-
 </code></pre>
 </div>
 
@@ -312,8 +282,7 @@ thankyou=Thank you for registering %{per
 
 <p><strong>Specify Global Property File In struts.xml</strong></p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>&lt;constant name="struts.custom.i18n.resources" value="global" /&gt;
-
+<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt">&lt;constant</span> <span class="na">name=</span><span class="s">"struts.custom.i18n.resources"</span> <span class="na">value=</span><span class="s">"global"</span> <span class="nt">/&gt;</span>
 </code></pre>
 </div>
 
@@ -321,9 +290,8 @@ thankyou=Thank you for registering %{per
 
 <p><strong>Using contact property</strong></p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>&lt;hr /&gt;
-&lt;s:text name="contact" /&gt;
-
+<div class="highlighter-rouge"><pre class="highlight"><code>    <span class="nt">&lt;hr</span> <span class="nt">/&gt;</span>
+    <span class="nt">&lt;s:text</span> <span class="na">name=</span><span class="s">"contact"</span> <span class="nt">/&gt;</span>
 </code></pre>
 </div>
 
@@ -337,9 +305,9 @@ thankyou=Thank you for registering %{per
 
 <p><strong>Internationalization (i18n)</strong></p>
 
-<p>Using message resource files (resource bundles) also enables you to provide text in different languages. By default, Struts 2 will use the user’s default locale. If that locale is en for English then the property files used will be the ones without a locale specification (for example Register.properties). If the locale is not English but say Spanish (es) then Struts 2 will look for a properties file named Register_es.properties.</p>
+<p>Using message resource files (resource bundles) also enables you to provide text in different languages. By default, Struts 2 will use the user’s default locale. If that locale is en for English then the property files used will be the ones without a locale specification (for example <code class="highlighter-rouge">Register.properties</code>). If the locale is not English but say Spanish (es) then Struts 2 will look for a properties file named <code class="highlighter-rouge">Register_es.properties</code>.</p>
 
-<p>To provide an example of Struts 2 support for i18n create a file named Register_es.properties and in that file add the following Spanish translations.</p>
+<p>To provide an example of Struts 2 support for i18n create a file named <code class="highlighter-rouge">Register_es.properties</code> and in that file add the following Spanish translations.</p>
 
 <p><strong>Register_es.properties</strong></p>
 
@@ -348,7 +316,6 @@ personBean.lastName=Apellidos
 personBean.age=Edad
 personBean.email=Correo
 thankyou=Gracias por registrarse, %{personBean.firstName}. 
-
 </code></pre>
 </div>
 
@@ -360,35 +327,27 @@ thankyou=Gracias por registrarse, %{pers
   </tbody>
 </table>
 
-<table>
-  <tbody>
-    <tr>
-    </tr>
-  </tbody>
-</table>
-
-<p>Save the Register_es.properties file in the same package as Register.properties.</p>
+<p>Save the <code class="highlighter-rouge">Register_es.properties</code> file in the same package as <code class="highlighter-rouge">Register.properties</code>.</p>
 
 <p>In our example application, we need to tell Struts 2 to use a locale value of es (since we’re not in a Spanish locale) instead of the default locale value of our location (which is en). Add the following markup to index.jsp.</p>
 
 <p><strong>Specify The Locale As a URL Parameter</strong></p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>&lt;h3&gt;Registro español&lt;/h3&gt;
-&lt;s:url action="registerInput" var="registerInputLinkES"&gt;
-    &lt;s:param name="request_locale"&gt;es&lt;/s:param&gt;
-&lt;/s:url&gt;
-&lt;p&gt;&lt;a href="${registerInputLinkES}"&gt;Por favor, regístrese&lt;/a&gt; para nuestro sorteo&lt;/p&gt;
-
+<div class="highlighter-rouge"><pre class="highlight"><code>    <span class="nt">&lt;h3&gt;</span>Registro español<span class="nt">&lt;/h3&gt;</span>
+    <span class="nt">&lt;s:url</span> <span class="na">action=</span><span class="s">"registerInput"</span> <span class="na">var=</span><span class="s">"registerInputLinkES"</span><span class="nt">&gt;</span>
+        <span class="nt">&lt;s:param</span> <span class="na">name=</span><span class="s">"request_locale"</span><span class="nt">&gt;</span>es<span class="nt">&lt;/s:param&gt;</span>
+    <span class="nt">&lt;/s:url&gt;</span>
+    <span class="nt">&lt;p&gt;&lt;a</span> <span class="na">href=</span><span class="s">"${registerInputLinkES}"</span><span class="nt">&gt;</span>Por favor, regístrese<span class="nt">&lt;/a&gt;</span> para nuestro sorteo<span class="nt">&lt;/p&gt;</span>
 </code></pre>
 </div>
 
-<p>In the above markup we’ve added a parameter named request_locale to the URL. The value of that parameter is es. The Action class that responds to this URL (Register.java) will see that the locale is es and will look for property files with _es (for example Register_es.properties). It will use those property files to find the values of the property keys referenced by the view page (e.g. personBean.firstName).</p>
+<p>In the above markup we’ve added a parameter named request_locale to the URL. The value of that parameter is es. The Action class that responds to this URL (Register.java) will see that the locale is es and will look for property files with _es (for example <code class="highlighter-rouge">Register_es.properties</code>). It will use those property files to find the values of the property keys referenced by the view page (e.g. personBean.firstName).</p>
 
 <p>After clicking on the above link you should see the same form as before but with the form field labels in Spanish.</p>
 
 <p><img src="attachments/att14975008_spanishform.png" alt="spanishform.png" /></p>
 
-<p>If we implement the same concept by creating _es.properties versions of global.properties (global_es.properties) and package.properties (package_es.properties) then we can create a complete registration web page in Spanish. Download the finished example application for this tutorial from Google Code - <a href="http://code.google.com/p/struts2-examples/downloads/list">http://code.google.com/p/struts2-examples/downloads/list</a> to see those property files and run the complete example with the registration form in Spanish.</p>
+<p>If we implement the same concept by creating _es.properties versions of <code class="highlighter-rouge">global.properties</code> (<code class="highlighter-rouge">global_es.properties</code>) and <code class="highlighter-rouge">package.properties</code> (<code class="highlighter-rouge">package_es.properties</code>) then we can create a complete registration web page in Spanish. Download the finished example application for this tutorial from Google Code - <a href="http://code.google.com/p/struts2-examples/downloads/list">http://code.google.com/p/struts2-examples/downloads/list</a> to see those property files and run the complete example with the registration form in Spanish.</p>
 
 <p><strong>Summary</strong></p>
 

Modified: websites/production/struts/content/getting-started/processing-forms.html
==============================================================================
--- websites/production/struts/content/getting-started/processing-forms.html (original)
+++ websites/production/struts/content/getting-started/processing-forms.html Sun Apr  2 09:12:56 2017
@@ -123,7 +123,7 @@
   <section class="col-md-12">
     <h2 id="processing-forms">Processing Forms</h2>
 
-<p>This tutorial assumes you’ve completed the <em>Coding Struts 2 Actons</em>  tutorial and have a working coding_actions project. The example code for this tutorial, form_processing, is available for checkout from the Struts 2 GitHub subversion repository: <a href="https://github.com/apache/struts-examples">https://github.com/apache/struts-examples</a>.</p>
+<p>This tutorial assumes you’ve completed the <a href="coding-actions.html">Coding Struts 2 Actons</a> tutorial and have a working coding_actions project. The example code for this tutorial, form_processing, is available for checkout from the Struts 2 GitHub subversion repository: <a href="https://github.com/apache/struts-examples">https://github.com/apache/struts-examples</a>.</p>
 
 <blockquote>
 
@@ -133,86 +133,61 @@
 
 <p>In this tutorial we’ll explore using Struts 2 to do more involved processing of a form submission. We’ll cover how to use a Java model class to store the form input and how to create the Struts 2 form to match up with that model class.</p>
 
-<p>The code provided in this tutorial may be added to the <em>Coding Struts 2 Actions</em>  example or you can download this complete example from Google Code - <a href="http://code.google.com/p/struts2-examples/downloads/list">http://code.google.com/p/struts2-examples/downloads/list</a>.</p>
+<p>The code provided in this tutorial may be added to the <a href="coding-actions.html">Coding Struts 2 Actions</a> example or you can download this complete example from Google Code - <a href="http://code.google.com/p/struts2-examples/downloads/list">http://code.google.com/p/struts2-examples/downloads/list</a>.</p>
 
-<table>
-  <tbody>
-    <tr>
-      <td>The <a href="http://struts.apache.org/mail.html">Struts 2 user mailing list</a>^[http://struts.apache.org/mail.html] is an excellent place to get help. If you are having a problem getting the tutorial example applications to work search the Struts 2 mailing list. If you don’t find an answer to your problem, post a question on the mailing list.</td>
-    </tr>
-  </tbody>
-</table>
-
-<table>
-  <tbody>
-    <tr>
-    </tr>
-  </tbody>
-</table>
+<p>The <a href="http://struts.apache.org/mail.html">Struts 2 user mailing list</a> is an excellent place to get help. If you are having a problem getting the tutorial example applications to work search the Struts 2 mailing list. If you don’t find an answer to your problem, post a question on the mailing list.</p>
 
 <p><strong>Forms and A Java Model Class</strong></p>
 
 <p>For this tutorial let’s say we need to provide a form that a user may submit to register for a prize drawing. Our business rules state the user must provide his/her first name, last name, email address, and age.</p>
 
-<p>To encapsulate this data, we’ll use a simple Java class that follows the basic Java Bean specifications (public set/get methods for each instance field). If you’re following along add this class to package org.apache.struts.register.model in the <em>Coding Struts 2 Actions</em>  example.</p>
+<p>To encapsulate this data, we’ll use a simple Java class that follows the basic Java Bean specifications (public set/get methods for each instance field). If you’re following along add this class to package org.apache.struts.register.model in the <a href="coding-actions.html">Coding Struts 2 Actions</a> example.</p>
 
 <p><strong>Person.java</strong></p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>public class Person
-{
-    private String firstName;
-    private String lastName;
-    private String email;
-    private int age;
-
-    public String getFirstName()
-    {
-        return firstName;
-    }
-
-    public void setFirstName(String firstName)
-    {
-        this.firstName = firstName;
-    }
-
-    public String getLastName()
-    {
-        return lastName;
-    }
-
-    public void setLastName(String lastName)
-    {
-        this.lastName = lastName;
-    }
-
-    public String getEmail()
-    {
-        return email;
-    }
-
-    public void setEmail(String email)
-    {
-        this.email = email;
-    }
-
-    public int getAge()
-    {
-        return age;
-    }
-
-    public void setAge( int age)
-    {
-        this.age = age;
-    }
-
-
-    public String toString()
-    {
-        return "First Name: " + getFirstName() + " Last Name:  " + getLastName() + 
-        " Email:      " + getEmail() + " Age:      " + getAge() ;
-    }
-}
-
+<div class="highlighter-rouge"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Person</span> <span class="o">{</span>
+    <span class="kd">private</span> <span class="n">String</span> <span class="n">firstName</span><span class="o">;</span>
+    <span class="kd">private</span> <span class="n">String</span> <span class="n">lastName</span><span class="o">;</span>
+    <span class="kd">private</span> <span class="n">String</span> <span class="n">email</span><span class="o">;</span>
+    <span class="kd">private</span> <span class="kt">int</span> <span class="n">age</span><span class="o">;</span>
+
+    <span class="kd">public</span> <span class="n">String</span> <span class="n">getFirstName</span><span class="o">()</span> <span class="o">{</span>
+        <span class="k">return</span> <span class="n">firstName</span><span class="o">;</span>
+    <span class="o">}</span>
+
+    <span class="kd">public</span> <span class="kt">void</span> <span class="n">setFirstName</span><span class="o">(</span><span class="n">String</span> <span class="n">firstName</span><span class="o">)</span> <span class="o">{</span>
+        <span class="k">this</span><span class="o">.</span><span class="na">firstName</span> <span class="o">=</span> <span class="n">firstName</span><span class="o">;</span>
+    <span class="o">}</span>
+
+    <span class="kd">public</span> <span class="n">String</span> <span class="n">getLastName</span><span class="o">()</span> <span class="o">{</span>
+        <span class="k">return</span> <span class="n">lastName</span><span class="o">;</span>
+    <span class="o">}</span>
+
+    <span class="kd">public</span> <span class="kt">void</span> <span class="n">setLastName</span><span class="o">(</span><span class="n">String</span> <span class="n">lastName</span><span class="o">)</span> <span class="o">{</span>
+        <span class="k">this</span><span class="o">.</span><span class="na">lastName</span> <span class="o">=</span> <span class="n">lastName</span><span class="o">;</span>
+    <span class="o">}</span>
+
+    <span class="kd">public</span> <span class="n">String</span> <span class="n">getEmail</span><span class="o">()</span> <span class="o">{</span>
+        <span class="k">return</span> <span class="n">email</span><span class="o">;</span>
+    <span class="o">}</span>
+
+    <span class="kd">public</span> <span class="kt">void</span> <span class="n">setEmail</span><span class="o">(</span><span class="n">String</span> <span class="n">email</span><span class="o">)</span> <span class="o">{</span>
+        <span class="k">this</span><span class="o">.</span><span class="na">email</span> <span class="o">=</span> <span class="n">email</span><span class="o">;</span>
+    <span class="o">}</span>
+
+    <span class="kd">public</span> <span class="kt">int</span> <span class="n">getAge</span><span class="o">()</span> <span class="o">{</span>
+        <span class="k">return</span> <span class="n">age</span><span class="o">;</span>
+    <span class="o">}</span>
+
+    <span class="kd">public</span> <span class="kt">void</span> <span class="n">setAge</span><span class="o">(</span><span class="kt">int</span> <span class="n">age</span><span class="o">)</span> <span class="o">{</span>
+        <span class="k">this</span><span class="o">.</span><span class="na">age</span> <span class="o">=</span> <span class="n">age</span><span class="o">;</span>
+    <span class="o">}</span>
+
+    <span class="kd">public</span> <span class="n">String</span> <span class="n">toString</span><span class="o">()</span> <span class="o">{</span>
+        <span class="k">return</span> <span class="s">"First Name: "</span> <span class="o">+</span> <span class="n">getFirstName</span><span class="o">()</span> <span class="o">+</span> <span class="s">" Last Name:  "</span> <span class="o">+</span> <span class="n">getLastName</span><span class="o">()</span> <span class="o">+</span> 
+        <span class="s">" Email:      "</span> <span class="o">+</span> <span class="n">getEmail</span><span class="o">()</span> <span class="o">+</span> <span class="s">" Age:      "</span> <span class="o">+</span> <span class="n">getAge</span><span class="o">()</span> <span class="o">;</span>
+    <span class="o">}</span>
+<span class="o">}</span>
 </code></pre>
 </div>
 
@@ -226,31 +201,29 @@
 
 <div class="highlighter-rouge"><pre class="highlight"><code><span class="cp">&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;</span>
 <span class="err">&lt;</span>%@ taglib prefix="s" uri="/struts-tags" %&gt;
-<span class="err">&lt;</span>%@ page language="java" contentType="text/html; charset=ISO-8859-1"
-    pageEncoding="ISO-8859-1"%&gt;
+<span class="err">&lt;</span>%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt;
 <span class="cp">&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;</span>
 <span class="nt">&lt;html</span> <span class="na">xmlns=</span><span class="s">"http://www.w3.org/1999/xhtml"</span><span class="nt">&gt;</span>
-<span class="nt">&lt;head&gt;</span>
-<span class="nt">&lt;meta</span> <span class="na">http-equiv=</span><span class="s">"Content-Type"</span> <span class="na">content=</span><span class="s">"text/html; charset=ISO-8859-1"</span> <span class="nt">/&gt;</span>
-<span class="nt">&lt;title&gt;</span>Register<span class="nt">&lt;/title&gt;</span>
-<span class="nt">&lt;/head&gt;</span>
-<span class="nt">&lt;body&gt;</span>
-<span class="nt">&lt;h3&gt;</span>Register for a prize by completing this form.<span class="nt">&lt;/h3&gt;</span>
-
-<span class="nt">&lt;s:form</span> <span class="na">action=</span><span class="s">"register"</span><span class="nt">&gt;</span>
-
- 	  <span class="nt">&lt;s:textfield</span> <span class="na">name=</span><span class="s">"personBean.firstName"</span> <span class="na">label=</span><span class="s">"First name"</span> <span class="nt">/&gt;</span>
- 	  <span class="nt">&lt;s:textfield</span>  <span class="na">name=</span><span class="s">"personBean.lastName"</span> <span class="na">label=</span><span class="s">"Last name"</span> <span class="nt">/&gt;</span>
- 	  <span class="nt">&lt;s:textfield</span> <span class="na">name=</span><span class="s">"personBean.email"</span>  <span class="na">label =</span><span class="s">"Email"</span><span class="nt">/&gt;</span>  
- 	  <span class="nt">&lt;s:textfield</span> <span class="na">name=</span><span class="s">"personBean.age"</span>  <span class="na">label=</span><span class="s">"Age"</span>  <span class="nt">/&gt;</span>
- 	  
-   	  <span class="nt">&lt;s:submit/&gt;</span>
+  <span class="nt">&lt;head&gt;</span>
+    <span class="nt">&lt;meta</span> <span class="na">http-equiv=</span><span class="s">"Content-Type"</span> <span class="na">content=</span><span class="s">"text/html; charset=ISO-8859-1"</span> <span class="nt">/&gt;</span>
+    <span class="nt">&lt;title&gt;</span>Register<span class="nt">&lt;/title&gt;</span>
+  <span class="nt">&lt;/head&gt;</span>
+  <span class="nt">&lt;body&gt;</span>
+    <span class="nt">&lt;h3&gt;</span>Register for a prize by completing this form.<span class="nt">&lt;/h3&gt;</span>
+
+    <span class="nt">&lt;s:form</span> <span class="na">action=</span><span class="s">"register"</span><span class="nt">&gt;</span>
+
+      <span class="nt">&lt;s:textfield</span> <span class="na">name=</span><span class="s">"personBean.firstName"</span> <span class="na">label=</span><span class="s">"First name"</span> <span class="nt">/&gt;</span>
+      <span class="nt">&lt;s:textfield</span> <span class="na">name=</span><span class="s">"personBean.lastName"</span> <span class="na">label=</span><span class="s">"Last name"</span> <span class="nt">/&gt;</span>
+      <span class="nt">&lt;s:textfield</span> <span class="na">name=</span><span class="s">"personBean.email"</span>  <span class="na">label =</span><span class="s">"Email"</span><span class="nt">/&gt;</span>  
+      <span class="nt">&lt;s:textfield</span> <span class="na">name=</span><span class="s">"personBean.age"</span>  <span class="na">label=</span><span class="s">"Age"</span>  <span class="nt">/&gt;</span>
+ 
+      <span class="nt">&lt;s:submit/&gt;</span>
    	  
-<span class="nt">&lt;/s:form&gt;</span>	
+    <span class="nt">&lt;/s:form&gt;</span>	
  
-<span class="nt">&lt;/body&gt;</span>
+  <span class="nt">&lt;/body&gt;</span>
 <span class="nt">&lt;/html&gt;</span>
-
 </code></pre>
 </div>
 
@@ -262,52 +235,45 @@
 
 <p>The complete name value, personBean.firstName, instructs Struts 2 to use the input value for that textfield as the argument to the personBean object’s setFirstName method. So if the user types “Bruce” in the textfield that has the label “First name”, the personBean’s firstName instance field will have a value of “Bruce”.</p>
 
-<p>Note we have a Struts 2 textfield for each instance field of the class Person. Remember that Person class’s age attribute is of type integer. All form field input values are Strings. Struts 2 will automatically convert the String value (“25”) the user entered for the age form field to 25 when calling the setAge method of object personBean.</p>
+<p>Note that we have a Struts 2 textfield for each instance field of the class Person. Remember that Person class’s age attribute is of type integer. All form field input values are Strings. Struts 2 will automatically convert the String value (“25”) the user entered for the age form field to 25 when calling the setAge method of object personBean.</p>
 
 <p><strong>Creating the Action Class To Handle the Form Submission</strong></p>
 
-<p>When the user clicks on the submit button of the above form, the action “register” and the form data will be sent to the Struts 2 framework. We need an Action class to process this form. If you recall from the tutorial <em>Coding Struts 2 Actions</em>  our Action class should extends the Struts 2 ActionSupport class.</p>
+<p>When the user clicks on the submit button of the above form, the action “register” and the form data will be sent to the Struts 2 framework. We need an Action class to process this form. If you recall from the tutorial <a href="coding-actions.html">Coding Struts 2 Actions</a> our Action class should extend the Struts 2 ActionSupport class.</p>
 
 <p>Here is the Action class used for this example. Place it in package org.apache.struts.register.action.</p>
 
 <p><strong>Register.java Struts 2 Action Class</strong></p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>package org.apache.struts.register.action;
+<div class="highlighter-rouge"><pre class="highlight"><code><span class="kn">package</span> <span class="n">org</span><span class="o">.</span><span class="na">apache</span><span class="o">.</span><span class="na">struts</span><span class="o">.</span><span class="na">register</span><span class="o">.</span><span class="na">action</span><span class="o">;</span>
 
-import org.apache.struts.register.model.Person;
+<span class="kn">import</span> <span class="nn">org.apache.struts.register.model.Person</span><span class="o">;</span>
 
-import com.opensymphony.xwork2.ActionSupport;
+<span class="kn">import</span> <span class="nn">com.opensymphony.xwork2.ActionSupport</span><span class="o">;</span>
 
-public class Register extends ActionSupport {
+<span class="kd">public</span> <span class="kd">class</span> <span class="nc">Register</span> <span class="kd">extends</span> <span class="n">ActionSupport</span> <span class="o">{</span>
 	
-	private static final long serialVersionUID = 1L;
+    <span class="kd">private</span> <span class="kd">static</span> <span class="kd">final</span> <span class="kt">long</span> <span class="n">serialVersionUID</span> <span class="o">=</span> <span class="mi">1L</span><span class="o">;</span>
 	
-	private Person personBean;
+    <span class="kd">private</span> <span class="n">Person</span> <span class="n">personBean</span><span class="o">;</span>
 	
 
-	@Override
-	public String execute() throws Exception {
-		
-		//call Service class to store personBean's state in database
-		
-		return SUCCESS;
-		
-	}
-	
-	public Person getPersonBean() {
-		
-		return personBean;
-		
-	}
-	
-	public void setPersonBean(Person person) {
-		
-		personBean = person;
-		
-	}
-
-}
+    <span class="nd">@Override</span>
+    <span class="kd">public</span> <span class="n">String</span> <span class="n">execute</span><span class="o">()</span> <span class="kd">throws</span> <span class="n">Exception</span> <span class="o">{</span>
+        <span class="c1">//call Service class to store personBean's state in database</span>
+
+        <span class="k">return</span> <span class="n">SUCCESS</span><span class="o">;</span>
+    <span class="o">}</span>
+
+    <span class="kd">public</span> <span class="n">Person</span> <span class="n">getPersonBean</span><span class="o">()</span> <span class="o">{</span>
+        <span class="k">return</span> <span class="n">personBean</span><span class="o">;</span>
+    <span class="o">}</span>
+
+    <span class="kd">public</span> <span class="kt">void</span> <span class="n">setPersonBean</span><span class="o">(</span><span class="n">Person</span> <span class="n">person</span><span class="o">)</span> <span class="o">{</span>
+        <span class="n">personBean</span> <span class="o">=</span> <span class="n">person</span><span class="o">;</span>
+    <span class="o">}</span>
 
+<span class="o">}</span>
 </code></pre>
 </div>
 
@@ -329,30 +295,25 @@ public class Register extends ActionSupp
 
 <div class="highlighter-rouge"><pre class="highlight"><code><span class="cp">&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;</span>
 <span class="err">&lt;</span>%@ taglib prefix="s" uri="/struts-tags" %&gt;
-<span class="err">&lt;</span>%@ page language="java" contentType="text/html; charset=ISO-8859-1"
-    pageEncoding="ISO-8859-1"%&gt;
+<span class="err">&lt;</span>%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt;
 <span class="cp">&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;</span>
 <span class="nt">&lt;html</span> <span class="na">xmlns=</span><span class="s">"http://www.w3.org/1999/xhtml"</span><span class="nt">&gt;</span>
-<span class="nt">&lt;head&gt;</span>
-<span class="nt">&lt;meta</span> <span class="na">http-equiv=</span><span class="s">"Content-Type"</span> <span class="na">content=</span><span class="s">"text/html; charset=ISO-8859-1"</span> <span class="nt">/&gt;</span>
-<span class="nt">&lt;title&gt;</span>Registration Successful<span class="nt">&lt;/title&gt;</span>
-<span class="nt">&lt;/head&gt;</span>
-<span class="nt">&lt;body&gt;</span>
-<span class="nt">&lt;h3&gt;</span>Thank you for registering for a prize.<span class="nt">&lt;/h3&gt;</span>
-
-<span class="nt">&lt;p&gt;</span>Your registration information: <span class="nt">&lt;s:property</span> <span class="na">value=</span><span class="s">"personBean"</span> <span class="nt">/&gt;</span> <span class="nt">&lt;/p&gt;</span>
+  <span class="nt">&lt;head&gt;</span>
+    <span class="nt">&lt;meta</span> <span class="na">http-equiv=</span><span class="s">"Content-Type"</span> <span class="na">content=</span><span class="s">"text/html; charset=ISO-8859-1"</span> <span class="nt">/&gt;</span>
+    <span class="nt">&lt;title&gt;</span>Registration Successful<span class="nt">&lt;/title&gt;</span>
+  <span class="nt">&lt;/head&gt;</span>
+  <span class="nt">&lt;body&gt;</span>
+    <span class="nt">&lt;h3&gt;</span>Thank you for registering for a prize.<span class="nt">&lt;/h3&gt;</span>
 
-<span class="nt">&lt;p&gt;&lt;a</span> <span class="na">href=</span><span class="s">"&lt;s:url action='index' /&gt;"</span> <span class="nt">&gt;</span>Return to home page<span class="nt">&lt;/a&gt;</span>.<span class="nt">&lt;/p&gt;</span>
+    <span class="nt">&lt;p&gt;</span>Your registration information: <span class="nt">&lt;s:property</span> <span class="na">value=</span><span class="s">"personBean"</span> <span class="nt">/&gt;</span> <span class="nt">&lt;/p&gt;</span>
 
-<span class="nt">&lt;/body&gt;</span>
+    <span class="nt">&lt;p&gt;&lt;a</span> <span class="na">href=</span><span class="s">"&lt;s:url action='index' /&gt;"</span> <span class="nt">&gt;</span>Return to home page<span class="nt">&lt;/a&gt;</span>.<span class="nt">&lt;/p&gt;</span>
+  <span class="nt">&lt;/body&gt;</span>
 <span class="nt">&lt;/html&gt;</span>
-
-
-
 </code></pre>
 </div>
 
-<p>If you don’t recall how the Struts 2 property and url tags work consult the <a href="#PAGE_14811875">Using Struts 2 Tags</a> tutorial.</p>
+<p>If you don’t recall how the Struts 2 property and url tags work consult the <a href="using-tags.html">Using Struts 2 Tags</a> tutorial.</p>
 
 <p><strong>Create action Node In struts.xml</strong></p>
 
@@ -360,11 +321,9 @@ public class Register extends ActionSupp
 
 <p><strong>action node for struts.xml</strong></p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>&lt;action name="register" class="org.apache.struts.register.action.Register" method="execute"&gt;
-  &lt;result name="success"&gt;/thankyou.jsp&lt;/result&gt;
-&lt;/action&gt;
-
-
+<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt">&lt;action</span> <span class="na">name=</span><span class="s">"register"</span> <span class="na">class=</span><span class="s">"org.apache.struts.register.action.Register"</span> <span class="na">method=</span><span class="s">"execute"</span><span class="nt">&gt;</span>
+  <span class="nt">&lt;result</span> <span class="na">name=</span><span class="s">"success"</span><span class="nt">&gt;</span>/thankyou.jsp<span class="nt">&lt;/result&gt;</span>
+<span class="nt">&lt;/action&gt;</span>
 </code></pre>
 </div>
 
@@ -378,8 +337,7 @@ public class Register extends ActionSupp
 
 <p><strong>Link to register.jsp</strong></p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>&lt;p&gt;&lt;a href="register.jsp"&gt;Please register&lt;/a&gt; for our prize drawing.&lt;/p&gt;
-
+<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt">&lt;p&gt;&lt;a</span> <span class="na">href=</span><span class="s">"register.jsp"</span><span class="nt">&gt;</span>Please register<span class="nt">&lt;/a&gt;</span> for our prize drawing.<span class="nt">&lt;/p&gt;</span>
 </code></pre>
 </div>
 

Modified: websites/production/struts/content/getting-started/spring.html
==============================================================================
--- websites/production/struts/content/getting-started/spring.html (original)
+++ websites/production/struts/content/getting-started/spring.html Sun Apr  2 09:12:56 2017
@@ -125,44 +125,15 @@
 
 <p>The example code for this tutorial, spring_struts, is available for checkout at <a href="https://github.com/apache/struts-examples">https://github.com/apache/struts-examples</a></p>
 
-<blockquote>
-
-</blockquote>
-
-<p>#####Introduction#####</p>
+<p><strong>Introduction</strong></p>
 
 <p>In the execute method of many Struts 2 ActionSupport classes are statements that create objects and then have those objects execute methods that perform needed tasks. Whenever one class creates an object of another class that introduces a dependency between the two classes. The Spring framework makes it easier for the application developer to manage these dependencies and helps make the application more flexible and maintainable. This tutorial will show you how to use Struts 2 and Spring together to manage the dependencies between your ActionSupport classes and other classes in your application.</p>
 
 <blockquote>
-
-</blockquote>
-
-<blockquote>
-
-</blockquote>
-
-<blockquote>
   <p>This tutorial assumes you understand how to use the Spring framework to manage dependencies between classes. You can learn more about Spring by reading the documentation at <a href="http://www.springsource.org/documentation">http://www.springsource.org/documentation</a></p>
 </blockquote>
 
-<blockquote>
-
-</blockquote>
-
-<table>
-  <tbody>
-    <tr>
-    </tr>
-  </tbody>
-</table>
-
-<table>
-  <tbody>
-    <tr>
-      <td>The <a href="http://struts.apache.org/mail.html">Struts 2 user mailing list</a>^[http://struts.apache.org/mail.html] is an excellent place to get help. If you are having a problem getting the tutorial example applications to work search the Struts 2 mailing list. If you don’t find an answer to your problem, post a question on the mailing list.</td>
-    </tr>
-  </tbody>
-</table>
+<p>The <a href="http://struts.apache.org/mail.html">Struts 2 user mailing list</a> is an excellent place to get help. If you are having a problem getting the tutorial example applications to work search the Struts 2 mailing list. If you don’t find an answer to your problem, post a question on the mailing list.</p>
 
 <table>
   <tbody>
@@ -175,85 +146,68 @@
 
 <p><strong>EditAction Class Hard-Coded Dependency</strong></p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>private EditService editService = new EditServiceInMemory();
-
-
+<div class="highlighter-rouge"><pre class="highlight"><code><span class="kd">private</span> <span class="n">EditService</span> <span class="n">editService</span> <span class="o">=</span> <span class="k">new</span> <span class="n">EditServiceInMemory</span><span class="o">();</span>
 </code></pre>
 </div>
 
-<p>The above statement hard-codes a dependency between the EditAction class and the EditServiceInMemory class. This is poor design for two reasons.</p>
+<p>The above statement hard-codes a dependency between the <code class="highlighter-rouge">EditAction</code> class and the <code class="highlighter-rouge">EditServiceInMemory</code> class. This is poor design for two reasons.</p>
 
 <ol>
   <li>
-    <p>If I need to replace the EditServiceInMemory with another class that implements the EditService interface I’ll have to hunt down and replace all statements where I hard-coded the dependency.</p>
+    <p>If I need to replace the <code class="highlighter-rouge">EditServiceInMemory</code> with another class that implements the <code class="highlighter-rouge">EditService</code> interface I’ll have to hunt down and replace all statements where I hard-coded the dependency.</p>
   </li>
   <li>
-    <p>I cannot test EditAction without using the EditServiceInMemory class. I cannot isolate EditAction by using a stub implementation of EditService when writing my test case because the use of EditServiceInMemory is hard-coded.</p>
+    <p>I cannot test <code class="highlighter-rouge">EditAction</code> without using the <code class="highlighter-rouge">EditServiceInMemory</code> class. I cannot isolate <code class="highlighter-rouge">EditAction</code> by using a stub implementation of <code class="highlighter-rouge">EditService</code> when writing my test case because the use of <code class="highlighter-rouge">EditServiceInMemory</code> is hard-coded.</p>
   </li>
 </ol>
 
-<p>Spring provides a mechanism to manage dependencies by injecting them at run time. Struts 2 ActionSupport classes—like any other Java class—can be injected with a dependent object by the Spring framework. So instead of having the above code, I would have this statement in EditAction.</p>
+<p>Spring provides a mechanism to manage dependencies by injecting them at run time. Struts 2 ActionSupport classes—like any other Java class—can be injected with a dependent object by the Spring framework. So instead of having the above code, I would have this statement in <code class="highlighter-rouge">EditAction</code>.</p>
 
 <p><strong>EditAction Class No Hard-Coded Dependency</strong></p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>    private EditService editService ;
-
-
+<div class="highlighter-rouge"><pre class="highlight"><code>    <span class="kd">private</span> <span class="n">EditService</span> <span class="n">editService</span> <span class="o">;</span>
 </code></pre>
 </div>
 
 <p>At run time the Spring framework will provide an object of a class that implements the EditService interface.</p>
 
-<p>#####Struts 2 Spring Plugin#####</p>
+<p><strong>Struts 2 Spring Plugin</strong></p>
 
-<p>Struts 2 provides a plugin that enables Spring to inject into the ActionSupport classes any dependent objects you’ve specified in the Spring configuration file. Consult <em>Spring Plugin documentation</em>  for more information about how the plugin works.</p>
+<p>Struts 2 provides a plugin that enables Spring to inject into the ActionSupport classes any dependent objects you’ve specified in the Spring configuration file. Consult <a href="//struts.apache.org/docs/spring-plugin.html">Spring Plugin documentation</a> for more information about how the plugin works.</p>
 
 <p>For a Maven application you’ll need to add a dependency to the struts2-spring-plugin jar (see the Maven example application for this tutorial). The plugin’s pom.xml includes transitive dependencies to the Spring jar files.</p>
 
 <table>
   <tbody>
     <tr>
-      <td>The current version (2.3.15) of the Struts 2 Spring plugin has transitive dependencies to the Spring 3.0.5 version. If you want to use the latest version of Spring, then you should exclude the transitive dependencies in your pom.xml for the Struts 2 Spring plugin and then declare dependency nodes to the current version of the Spring jar files. If you are using Ant and explicitly including the jar files in your application, then just include the latest version of the Spring jar files.</td>
+      <td>The current version (<code class="highlighter-rouge">2.5.10.1</code>) of the Struts 2 Spring plugin has transitive dependencies to the Spring <code class="highlighter-rouge">4.1.6.RELEASE</code> version. If you want to use the latest version of Spring, then you should exclude the transitive dependencies in your pom.xml for the Struts 2 Spring plugin and then declare dependency nodes to the current version of the Spring jar files. If you are using Ant and explicitly including the jar files in your application, then just include the latest version of the Spring jar files.</td>
     </tr>
   </tbody>
 </table>
 
-<table>
-  <tbody>
-    <tr>
-    </tr>
-  </tbody>
-</table>
-
-<p>In your ActionSupport class you must have a set method for the dependent object that follows standard Java bean naming conventions. If you examine the EditAction class for this tutorial’s application you’ll see this set method.</p>
-
-<div class="highlighter-rouge"><pre class="highlight"><code>public void setEditService(EditService editService) {
-		
-   this.editService = editService;
-		
-}
-
+<p>In your <code class="highlighter-rouge">ActionSupport</code> class you must have a set method for the dependent object that follows standard Java bean naming conventions. If you examine the <code class="highlighter-rouge">EditAction</code> class for this tutorial’s application you’ll see this set method.</p>
 
+<div class="highlighter-rouge"><pre class="highlight"><code><span class="kd">public</span> <span class="kt">void</span> <span class="nf">setEditService</span><span class="p">(</span><span class="n">EditService</span> <span class="n">editService</span><span class="o">)</span> <span class="o">{</span>
+    <span class="k">this</span><span class="o">.</span><span class="na">editService</span> <span class="o">=</span> <span class="n">editService</span><span class="o">;</span>
+<span class="o">}</span>
 </code></pre>
 </div>
 
-<p>Spring will use that set method to provide an object of type EditService to the EditAction class at run time.</p>
+<p>Spring will use that set method to provide an object of type <code class="highlighter-rouge">EditService</code> to the <code class="highlighter-rouge">EditAction</code> class at run time.</p>
 
 <p>To make our application “Spring aware” we need to add this line to web.xml.</p>
 
 <p><strong>Spring Listener In web.xml</strong></p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>&lt;listener&gt;
-	&lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
-&lt;/listener&gt;
-
-
+<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt">&lt;listener&gt;</span>
+    <span class="nt">&lt;listener-class&gt;</span>org.springframework.web.context.ContextLoaderListener<span class="nt">&lt;/listener-class&gt;</span>
+<span class="nt">&lt;/listener&gt;</span>
 </code></pre>
 </div>
 
 <p>The above code will activate the Spring framework when the application is started up by the Servlet container. By default Spring will look for a configuration file name applicationContext.xml in WEB-INF (consult the Spring documentation for how you can change where Spring looks and what the configuration file name is).</p>
 
-<p>#####Spring Configuration File#####</p>
+<p><strong>Spring Configuration File</strong></p>
 
 <p>In the Spring configuration file we create a bean node for those objects we want Spring to create an instance of and inject into our ActionSupport class. In the example application is this applicationContext.xml.</p>
 
@@ -266,34 +220,19 @@
             <span class="err">http://www.springframework.org/schema/beans</span>
             <span class="err">http://www.springframework.org/schema/beans/spring-beans.xsd"</span><span class="nt">&gt;</span>
 
-<span class="nt">&lt;bean</span> <span class="na">id=</span><span class="s">"editService"</span> <span class="na">class=</span><span class="s">"org.apache.struts.edit.service.EditServiceInMemory"</span> <span class="nt">/&gt;</span>
+    <span class="nt">&lt;bean</span> <span class="na">id=</span><span class="s">"editService"</span> <span class="na">class=</span><span class="s">"org.apache.struts.edit.service.EditServiceInMemory"</span> <span class="nt">/&gt;</span>
 
 <span class="nt">&lt;/beans&gt;</span>
-
-
 </code></pre>
 </div>
 
-<p>Note the id value above. By default the Spring plugin works with Spring to autowire the dependencies of the ActionClass by “name.” Spring will create an object of class EditServiceMemory and provide that object to any ActionSupport class that has a setEditService method with an argument of type EditService. Consult the <em>Spring Plugin</em>  documentation for how to change the default autowire method.</p>
+<p>Note the id value above. By default the Spring plugin works with Spring to autowire the dependencies of the ActionClass by “name.” Spring will create an object of class EditServiceMemory and provide that object to any ActionSupport class that has a setEditService method with an argument of type EditService. Consult the <a href="//struts.apache.org/docs/spring-plugin.html">Spring Plugin</a> documentation for how to change the default autowire method.</p>
 
-<table>
-  <tbody>
-    <tr>
-      <td>The editService bean created by Spring will have a scope of singleton since that is the default scope. Consult section 3.5 of the <a href="http://www.springsource.org/documentation">Spring documentation</a>^[http://www.springsource.org/documentation] for how to configure the bean definition to use a different scope (e.g. request or session).</td>
-    </tr>
-  </tbody>
-</table>
+<p>The editService bean created by Spring will have a scope of singleton since that is the default scope. Consult section 3.5 of the <a href="http://www.springsource.org/documentation">Spring documentation</a> for how to configure the bean definition to use a different scope (e.g. request or session).</p>
 
-<table>
-  <tbody>
-    <tr>
-    </tr>
-  </tbody>
-</table>
+<p><strong>Alternative - Have Spring Manage Creation Of ActionSupport Class</strong></p>
 
-<p>#####Alternative - Have Spring Manage Creation Of ActionSupport Class#####</p>
-
-<p>Using the above methodology, the Struts 2 framework will still manage the creation of the ActionSupport class. If you prefer you can configure the application so that Spring will create the ActionSupport class also. To support this technique you need to add a bean node to the Spring configuration file for the ActionSupport class.</p>
+<p>Using the above methodology, the Struts 2 framework will still manage the creation of the <code class="highlighter-rouge">ActionSupport</code> class. If you prefer you can configure the application so that Spring will create the ActionSupport class also. To support this technique you need to add a bean node to the Spring configuration file for the ActionSupport class.</p>
 
 <p><strong>Spring Configuration For ActionSupport Class Managed By Spring</strong></p>
 
@@ -304,83 +243,29 @@
             <span class="err">http://www.springframework.org/schema/beans</span>
             <span class="err">http://www.springframework.org/schema/beans/spring-beans.xsd"</span><span class="nt">&gt;</span>
             
+    <span class="nt">&lt;bean</span> <span class="na">id=</span><span class="s">"editService"</span> <span class="na">class=</span><span class="s">"org.apache.struts.edit.service.EditServiceInMemory"</span> <span class="nt">/&gt;</span>
 
-<span class="nt">&lt;bean</span> <span class="na">id=</span><span class="s">"editService"</span> <span class="na">class=</span><span class="s">"org.apache.struts.edit.service.EditServiceInMemory"</span> <span class="nt">/&gt;</span>
-
-<span class="nt">&lt;bean</span> <span class="na">id=</span><span class="s">"editAction"</span> <span class="na">class=</span><span class="s">"org.apache.struts.edit.action.EditAction"</span> <span class="na">scope=</span><span class="s">"prototype"</span><span class="nt">&gt;</span>
-
-	<span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">"editService"</span> <span class="na">ref=</span><span class="s">"editService"</span> <span class="nt">/&gt;</span>
-	
-<span class="nt">&lt;/bean&gt;</span>
+    <span class="nt">&lt;bean</span> <span class="na">id=</span><span class="s">"editAction"</span> <span class="na">class=</span><span class="s">"org.apache.struts.edit.action.EditAction"</span> <span class="na">scope=</span><span class="s">"prototype"</span><span class="nt">&gt;</span>
+        <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">"editService"</span> <span class="na">ref=</span><span class="s">"editService"</span> <span class="nt">/&gt;</span>
+    <span class="nt">&lt;/bean&gt;</span>
 
 <span class="nt">&lt;/beans&gt;</span>
-
-
-</code></pre>
-</div>
-
-<p>Note in the above that there is an</p>
-
-<div class="highlighter-rouge"><pre class="highlight"><code>editAction
-</code></pre>
-</div>
-<p> bean and its</p>
-
-<div class="highlighter-rouge"><pre class="highlight"><code>editService
-</code></pre>
-</div>
-<p> property is set to the</p>
-
-<div class="highlighter-rouge"><pre class="highlight"><code>editService
-</code></pre>
-</div>
-<p> bean. Since we are having Spring manage the</p>
-
-<div class="highlighter-rouge"><pre class="highlight"><code>EditAction
 </code></pre>
 </div>
-<p> class we must specify any properties of</p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>EditAction
-</code></pre>
-</div>
-<p> that we want Spring to inject. Please remember that actions must be created on each request, they cannot be </p>
+<p>Note in the above that there is an <code class="highlighter-rouge">editAction</code> bean and its <code class="highlighter-rouge">editService</code> property is set to the <code class="highlighter-rouge">editService</code> bean. Since we are having Spring manage the <code class="highlighter-rouge">EditAction</code> class we must specify any properties of <code class="highlighter-rouge">EditAction</code> that we want Spring to inject. Please remember that actions must be created on each request, they cannot be <code class="highlighter-rouge">singletons</code>- this is the default <code class="highlighter-rouge">scope</code> that’s why it must be changed to <code class="highlighter-rouge">prototype</code>.</p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>singletons
-</code></pre>
-</div>
-<ul>
-  <li>this is the default </li>
-</ul>
-
-<div class="highlighter-rouge"><pre class="highlight"><code>scope
-</code></pre>
-</div>
-<p>that’s why it must be changed to </p>
-
-<div class="highlighter-rouge"><pre class="highlight"><code>prototype
-</code></pre>
-</div>
-<p>.</p>
-
-<p>In the</p>
-
-<div class="highlighter-rouge"><pre class="highlight"><code>struts.xml
-</code></pre>
-</div>
-<p> configuration file you must specify the Spring id value for the class attribute of the action node. This tells Struts to get a bean with that id value from Spring for the Action class.</p>
+<p>In the <code class="highlighter-rouge">struts.xml</code> configuration file you must specify the Spring id value for the class attribute of the action node. This tells Struts to get a bean with that id value from Spring for the Action class.</p>
 
 <p><strong>Struts Configuration For Spring Managed ActionSupport Class</strong></p>
 
-<div class="highlighter-rouge"><pre class="highlight"><code>&lt;action name="edit" class="editAction" method="input"&gt;
-	&lt;result name="input"&gt;/edit.jsp&lt;/result&gt;
-&lt;/action&gt;
-
-
+<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt">&lt;action</span> <span class="na">name=</span><span class="s">"edit"</span> <span class="na">class=</span><span class="s">"editAction"</span> <span class="na">method=</span><span class="s">"input"</span><span class="nt">&gt;</span>
+    <span class="nt">&lt;result</span> <span class="na">name=</span><span class="s">"input"</span><span class="nt">&gt;</span>/edit.jsp<span class="nt">&lt;/result&gt;</span>
+<span class="nt">&lt;/action&gt;</span>
 </code></pre>
 </div>
 
-<p>#####Summary#####</p>
+<p><strong>Summary</strong></p>
 
 <p>In this tutorial we reviewed how to use the Struts 2 Spring plugin to integrate Spring and Struts. By using the Struts 2 Spring plugin you can have Spring manage the dependencies of your ActionSupport classes. Of course you can also take advantage of the many other benefits (AOP, Spring JDBC) that the Spring framework provides.</p>
 



Mime
View raw message