struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject svn commit: r1009449 [5/10] - in /websites/production/struts/content: ./ bootstrap/css/ fonts/ getting-started/ getting-started/attachments/
Date Fri, 31 Mar 2017 05:44:40 GMT
Added: websites/production/struts/content/getting-started/debugging-struts.html
==============================================================================
--- websites/production/struts/content/getting-started/debugging-struts.html (added)
+++ websites/production/struts/content/getting-started/debugging-struts.html Fri Mar 31 05:44:39 2017
@@ -0,0 +1,252 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8"/>
+  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+  <meta name="Date-Revision-yyyymmdd" content="20140918"/>
+  <meta http-equiv="Content-Language" content="en"/>
+  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+
+  <title>Debugging Struts</title>
+
+  <link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,400italic,600italic,700italic" rel="stylesheet" type="text/css">
+  <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
+  <link href="/css/main.css" rel="stylesheet">
+  <link href="/css/custom.css" rel="stylesheet">
+
+  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
+  <script type="text/javascript" src="/bootstrap/js/bootstrap.js"></script>
+  <script type="text/javascript" src="/js/community.js"></script>
+</head>
+<body>
+
+<a href="http://github.com/apache/struts" class="github-ribbon">
+  <img style="position: absolute; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub">
+</a>
+
+<header>
+  <nav>
+    <div role="navigation" class="navbar navbar-default navbar-fixed-top">
+      <div class="container">
+        <div class="navbar-header">
+          <button type="button" data-toggle="collapse" data-target="#struts-menu" class="navbar-toggle">
+            Menu
+            <span class="sr-only">Toggle navigation</span>
+            <span class="icon-bar"></span>
+            <span class="icon-bar"></span>
+            <span class="icon-bar"></span>
+          </button>
+          <a href="/index.html" class="navbar-brand logo"><img src="/img/struts-logo.svg"></a>
+        </div>
+        <div id="struts-menu" class="navbar-collapse collapse">
+          <ul class="nav navbar-nav">
+            <li class="dropdown">
+              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+                Home<b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <li><a href="/index.html">Welcome</a></li>
+                <li><a href="/downloads.html">Downloads</a></li>
+                <li><a href="/announce.html">Announcements</a></li>
+                <li><a href="http://www.apache.org/licenses/">License</a></li>
+                <li><a href="http://apache.org/foundation/thanks.html">Thanks!</a></li>
+                <li><a href="http://apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+              </ul>
+            </li>
+            <li class="dropdown">
+              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+                Support<b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <li><a href="/mail.html">User Mailing List</a></li>
+                <li><a href="https://issues.apache.org/jira/browse/WW">Issue Tracker</a></li>
+                <li><a href="/security.html">Reporting Security Issues</a></li>
+                <li class="divider"></li>
+                <li><a href="/maven/project-info.html">Project info</a></li>
+                <li><a href="/maven/struts2-core/dependencies.html">Struts Core dependencies</a></li>
+                <li><a href="/maven/struts2-plugins/modules.html">Plugin dependencies</a></li>
+              </ul>
+            </li>
+            <li class="dropdown">
+              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+                Documentation<b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <li><a href="/birdseye.html">Birds Eye</a></li>
+                <li><a href="/primer.html">Key Technologies</a></li>
+                <li><a href="/kickstart.html">Kickstart FAQ</a></li>
+                <li><a href="https://cwiki.apache.org/confluence/display/WW/Home">Wiki</a></li>
+                <li class="divider"></li>
+                <li><a href="/docs/home.html">Getting started</a></li>
+                <li><a href="/docs/tutorials.html">Tutorials</a></li>
+                <li><a href="/docs/faqs.html">FAQs</a></li>
+                <li><a href="/docs/guides.html">Guides</a></li>
+                <li class="divider"></li>
+                <li><a href="/maven/struts2-core/apidocs/index.html">Struts Core API</a></li>
+                <li><a href="/docs/plugins.html">Plugin APIs</a></li>
+                <li><a href="/docs/tag-reference.html">Tag reference</a></li>
+                <li><a href="http://cwiki.apache.org/S2PLUGINS/home.html">Plugin registry</a></li>
+                <li class="divider"></li>
+                <li><a href="/getting-started/getting-started.html">Getting Started (WIP)</a></li>
+              </ul>
+            </li>
+            <li class="dropdown">
+              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+                Contributing<b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <li><a href="/youatstruts.html">You at Struts</a></li>
+                <li><a href="/helping.html">How to Help FAQ</a></li>
+                <li><a href="/dev-mail.html">Development Lists</a></li>
+                <li class="divider"></li>
+                <li><a href="/submitting-patches.html">Submitting patches</a></li>
+                <li><a href="/builds.html">Source Code</a></li>
+                <li><a href="/coding-standards.html">Coding standards</a></li>
+                <li class="divider"></li>
+                <li><a href="/releases.html">Release Guidelines</a></li>
+                <li><a href="/bylaws.html">PMC Charter</a></li>
+                <li><a href="/volunteers.html">Volunteers</a></li>
+                <li><a href="https://git-wip-us.apache.org/repos/asf?p=struts.git">Source Repository</a></li>
+              </ul>
+            </li>
+            <li class="apache"><a href="http://www.apache.org/"><img src="/img/apache.png"></a></li>
+          </ul>
+        </div>
+      </div>
+    </div>
+  </nav>
+</header>
+
+
+<article class="container">
+  <section class="col-md-12">
+    <h2 id="debugging-struts">Debugging Struts</h2>
+
+<p>The example code for this tutorial, debugging_struts, is available for checkout at <a href="https://github.com/apache/struts-examples">https://github.com/apache/struts-examples</a>.</p>
+
+<p><strong>Introduction</strong></p>
+
+<p>During development of a Struts 2 web application you may want to view the information being managed by the Struts 2 framework. This tutorial will cover two tools you can use to see how Struts 2 views your web application. One tool is the Struts 2 configuration plugin and the other is the debugging interceptor. This article also discusses how to set the log level to see more or fewer log messages.</p>
+
+<table>
+  <tbody>
+    <tr>
+      <td>The Struts 2 <a href="http://struts.apache.org/mail.html">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><strong>Configuration Plugin</strong></p>
+
+<p>The Struts 2 config browser plugin provides details about the configuration the Struts 2 framework is using to run your application. To use the plugin your application needs to have the struts2-config-browser-plugin-x.x.x.x.jar in your application’s class path. The config-browser-plugin jar is part of the Struts 2 download and is also available in the Maven repository.</p>
+
+<p>To use the plugin in your application, just call index.action in namespace config-browser. For example you could have the following link on your admin page (or just anywhere during your development).</p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>&lt;a href="&lt;s:url action="index" namespace="config-browser" /&gt;"&gt;Launch the configuration browser&lt;/a&gt;
+
+</code></pre>
+</div>
+
+<p>In the example application, there is a link to the configuration browser on the index.jsp page.</p>
+
+<p>Clicking on the link for the configuration browser will cause the Struts 2 framework to return this page to your browser.</p>
+
+<p><img src="attachments/att17137672_debuging-struts-1.png" alt="debuging-struts-1.png" /></p>
+
+<p>You can click on an action link to see the configuration for that action. For example clicking on the register action link results in this.</p>
+
+<p><img src="attachments/att17137673_debuging-struts-2.png" alt="debuging-struts-2.png" /></p>
+
+<p>You may then click on one of the tabs (Results, Exception Mappings, Interceptors, Properties, Validators) to get more information about how the Struts 2 framework is has configured that specific action.</p>
+
+<p>On the left side of the page is the config browser plugin menu. Clicking on constants will render a view that lists all the Struts 2 constants and their properties for your application. Clicking on beans shows the beans Struts 2 is managing. Clicking on Jars shows the jars your application is using.</p>
+
+<p><strong>Using the Debugging Interceptor</strong></p>
+
+<p>If you have set</p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>devMode
+</code></pre>
+</div>
+<p>to true (in the example application see struts.xml) then one of the interceptors that is activated when Struts 2 processes an action is the DebuggingInterceptor. The DebuggingInterceptor looks for a query string appended to the action URL with a name of debug and a value of xml, console, command, or browser.</p>
+
+<p>If the DebuggingInterceptor finds that query string then it will halt further execution of the action and instead return to the browser debugging information. The format of the returned information depends on the value of the debug query parameter. See <em>DebuggingInterceptor</em>  for more detail.</p>
+
+<p>In the example application on the index.jsp is a link for displaying debugging information. This link includes the query string debug=browser. If you click on this link you’ll see a table with columns that can be expanded and collapsed. The table contains the various objects and their state being managed by the Struts 2 framework.</p>
+
+<p><img src="attachments/att17137674_debuging-struts-3.png" alt="debuging-struts-3.png" /></p>
+
+<p>Note that to enable the correct display and interaction of the expand/collapse links on the debugging information web page you need to include the s:head tag in your JSP’s head section (see index.jsp in the example application) and also include the Struts 2 dojo plugin in your application’s class path. The Struts 2 dojo plugin is available as part of the Struts 2 download and from the Maven repository.</p>
+
+<p><strong>Struts 2 Logging</strong></p>
+
+<p>The Struts 2 framework will write to a log a great deal of information if you’ve configured the log properties to log at the debug level. In the example application, view log4j.xml. The two major packages involved in the Struts 2 framework, com.opensymphony and org.apache.struts2, are configured to write debug and above log messages. When you run the application view the standard out for your Servlet container to see all the information written to the log. Please check <em>Logging</em>  page for other options.</p>
+
+<p><strong>Summary</strong></p>
+
+<p>Using the configuration browser plugin and the debugging interceptor can assist you in trouble shooting a problem with a Struts 2 web application. These tools should only be used in development.</p>
+
+<p>Prior to creating your war file for deployment to production you should change devmode to false and remove the debugging links. You may also want to adjust the level of logging in your log properties file to a higher level (info or warn) to reduce the number of log messages.</p>
+
+  </section>
+</article>
+
+
+<footer class="container">
+  <div class="col-md-12">
+    Copyright &copy; 2000-2016 <a href="http://www.apache.org/">The Apache Software Foundation </a>.
+    All Rights Reserved.
+  </div>
+  <div class="col-md-12">
+    Apache Struts, Struts, Apache, the Apache feather logo, and the Apache Struts project logos are
+    trademarks of The Apache Software Foundation.
+  </div>
+  <div class="col-md-12">Logo and website design donated by <a href="https://softwaremill.com/">SoftwareMill</a>.</div>
+</footer>
+
+<script>!function (d, s, id) {
+  var js, fjs = d.getElementsByTagName(s)[0];
+  if (!d.getElementById(id)) {
+    js = d.createElement(s);
+    js.id = id;
+    js.src = "//platform.twitter.com/widgets.js";
+    fjs.parentNode.insertBefore(js, fjs);
+  }
+}(document, "script", "twitter-wjs");</script>
+<script src="https://apis.google.com/js/platform.js" async="async" defer="defer"></script>
+
+<div id="fb-root"></div>
+
+<script>(function (d, s, id) {
+  var js, fjs = d.getElementsByTagName(s)[0];
+  if (d.getElementById(id)) return;
+  js = d.createElement(s);
+  js.id = id;
+  js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";
+  fjs.parentNode.insertBefore(js, fjs);
+}(document, 'script', 'facebook-jssdk'));</script>
+
+
+<script>
+$(function() {
+  return $("h2, h3, h4, h5, h6").each(function(i, el) {
+    var $el, icon, id;
+    $el = $(el);
+    id = $el.attr('id');
+    icon = '<i class="fa fa-link"></i>';
+    if (id) {
+      return $el.prepend($("<a />").addClass("header-link").attr("href", "#" + id).html(icon));
+    }
+  });
+});
+</script>
+
+</body>
+</html>

Added: websites/production/struts/content/getting-started/exception-handling.html
==============================================================================
--- websites/production/struts/content/getting-started/exception-handling.html (added)
+++ websites/production/struts/content/getting-started/exception-handling.html Fri Mar 31 05:44:39 2017
@@ -0,0 +1,299 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8"/>
+  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+  <meta name="Date-Revision-yyyymmdd" content="20140918"/>
+  <meta http-equiv="Content-Language" content="en"/>
+  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+
+  <title>Exception handling</title>
+
+  <link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,400italic,600italic,700italic" rel="stylesheet" type="text/css">
+  <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
+  <link href="/css/main.css" rel="stylesheet">
+  <link href="/css/custom.css" rel="stylesheet">
+
+  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
+  <script type="text/javascript" src="/bootstrap/js/bootstrap.js"></script>
+  <script type="text/javascript" src="/js/community.js"></script>
+</head>
+<body>
+
+<a href="http://github.com/apache/struts" class="github-ribbon">
+  <img style="position: absolute; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub">
+</a>
+
+<header>
+  <nav>
+    <div role="navigation" class="navbar navbar-default navbar-fixed-top">
+      <div class="container">
+        <div class="navbar-header">
+          <button type="button" data-toggle="collapse" data-target="#struts-menu" class="navbar-toggle">
+            Menu
+            <span class="sr-only">Toggle navigation</span>
+            <span class="icon-bar"></span>
+            <span class="icon-bar"></span>
+            <span class="icon-bar"></span>
+          </button>
+          <a href="/index.html" class="navbar-brand logo"><img src="/img/struts-logo.svg"></a>
+        </div>
+        <div id="struts-menu" class="navbar-collapse collapse">
+          <ul class="nav navbar-nav">
+            <li class="dropdown">
+              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+                Home<b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <li><a href="/index.html">Welcome</a></li>
+                <li><a href="/downloads.html">Downloads</a></li>
+                <li><a href="/announce.html">Announcements</a></li>
+                <li><a href="http://www.apache.org/licenses/">License</a></li>
+                <li><a href="http://apache.org/foundation/thanks.html">Thanks!</a></li>
+                <li><a href="http://apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+              </ul>
+            </li>
+            <li class="dropdown">
+              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+                Support<b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <li><a href="/mail.html">User Mailing List</a></li>
+                <li><a href="https://issues.apache.org/jira/browse/WW">Issue Tracker</a></li>
+                <li><a href="/security.html">Reporting Security Issues</a></li>
+                <li class="divider"></li>
+                <li><a href="/maven/project-info.html">Project info</a></li>
+                <li><a href="/maven/struts2-core/dependencies.html">Struts Core dependencies</a></li>
+                <li><a href="/maven/struts2-plugins/modules.html">Plugin dependencies</a></li>
+              </ul>
+            </li>
+            <li class="dropdown">
+              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+                Documentation<b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <li><a href="/birdseye.html">Birds Eye</a></li>
+                <li><a href="/primer.html">Key Technologies</a></li>
+                <li><a href="/kickstart.html">Kickstart FAQ</a></li>
+                <li><a href="https://cwiki.apache.org/confluence/display/WW/Home">Wiki</a></li>
+                <li class="divider"></li>
+                <li><a href="/docs/home.html">Getting started</a></li>
+                <li><a href="/docs/tutorials.html">Tutorials</a></li>
+                <li><a href="/docs/faqs.html">FAQs</a></li>
+                <li><a href="/docs/guides.html">Guides</a></li>
+                <li class="divider"></li>
+                <li><a href="/maven/struts2-core/apidocs/index.html">Struts Core API</a></li>
+                <li><a href="/docs/plugins.html">Plugin APIs</a></li>
+                <li><a href="/docs/tag-reference.html">Tag reference</a></li>
+                <li><a href="http://cwiki.apache.org/S2PLUGINS/home.html">Plugin registry</a></li>
+                <li class="divider"></li>
+                <li><a href="/getting-started/getting-started.html">Getting Started (WIP)</a></li>
+              </ul>
+            </li>
+            <li class="dropdown">
+              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+                Contributing<b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <li><a href="/youatstruts.html">You at Struts</a></li>
+                <li><a href="/helping.html">How to Help FAQ</a></li>
+                <li><a href="/dev-mail.html">Development Lists</a></li>
+                <li class="divider"></li>
+                <li><a href="/submitting-patches.html">Submitting patches</a></li>
+                <li><a href="/builds.html">Source Code</a></li>
+                <li><a href="/coding-standards.html">Coding standards</a></li>
+                <li class="divider"></li>
+                <li><a href="/releases.html">Release Guidelines</a></li>
+                <li><a href="/bylaws.html">PMC Charter</a></li>
+                <li><a href="/volunteers.html">Volunteers</a></li>
+                <li><a href="https://git-wip-us.apache.org/repos/asf?p=struts.git">Source Repository</a></li>
+              </ul>
+            </li>
+            <li class="apache"><a href="http://www.apache.org/"><img src="/img/apache.png"></a></li>
+          </ul>
+        </div>
+      </div>
+    </div>
+  </nav>
+</header>
+
+
+<article class="container">
+  <section class="col-md-12">
+    <h2 id="exception-handling">Exception Handling</h2>
+
+<p>The code for this tutorial, exception_handling, 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>In this tutorial we’ll explore how to enable the Struts 2 framework to handle any uncaught exceptions generated by a web application. Struts 2 provides robust exception handling, including the ability to automatically log any uncaught exceptions and redirect the user to a error web page.</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>#####Global Exception Handling#####</p>
+
+<p>Using the Struts 2 framework you can specify in the struts.xml how the framework should handle uncaught exceptions. The handling logic can apply to all actions (global exception handling) or to a specific action. Let’s first discuss how to enable global exception handling.</p>
+
+<p>To enable global exception handling you need to add two nodes to struts.xml: global-exception-mapping and global-results. For example examine struts.xml from the exception_handling project.</p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>  
+   &lt;global-results&gt;
+        &lt;result name="securityerror"&gt;/securityerror.jsp&lt;/result&gt;
+  	&lt;result name="error"&gt;/error.jsp&lt;/result&gt;
+   &lt;/global-results&gt;
+
+   &lt;global-exception-mappings&gt;
+	&lt;exception-mapping exception="org.apache.struts.register.exceptions.SecurityBreachException" result="securityerror" /&gt;
+	 &lt;exception-mapping exception="java.lang.Exception" result="error" /&gt;
+   &lt;/global-exception-mappings&gt;
+  
+
+</code></pre>
+</div>
+
+<p>The global exception mapping node tells the Struts 2 framework what to do if an uncaught exception of the type specified (or a child of that type) is thrown by the the application. For example if a SecurityBreachException is thrown but not caught, the Struts 2 Action class will return a result of “securityerror”. All other uncaught exceptions will cause the Struts 2 Action class to return a result of “error”.</p>
+
+<p>The global results mapping node relates the result value to a specific view page. For example the result “securityerror” will cause the framework to redirect the user’s browser to the securityerror.jsp view page.</p>
+
+<p>#####Exception Handling Per Action#####</p>
+
+<p>If you need to handle an exception in a specific way for a certain action you can use the exception-mapping node within the action node.</p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>   &lt;action name="actionspecificexception" class="org.apache.struts.register.action.Register" method="throwSecurityException"&gt;
+     &lt;exception-mapping exception="org.apache.struts.register.exceptions.SecurityBreachException" 
+          result="login" /&gt;
+      &lt;result&gt;/register.jsp&lt;/result&gt;
+      &lt;result name="login"&gt;/login.jsp&lt;/result&gt;
+   &lt;/action&gt;
+
+
+</code></pre>
+</div>
+
+<p>The above action node from the example application’s struts.xml file specifies that if method throwSecurityException throws an uncaught exception of type SecurityBreachException the Struts 2 framework should return a result of login. The login result will cause the user’s browser to be redirected to login.jsp.</p>
+
+<p>You can see that an action-specific exception mapping will take precedence if the same exception is also mapped globally.</p>
+
+<p>#####Logging Exceptions#####</p>
+
+<p>You can configure the Struts 2 framework to log any uncaught exceptions. To enable logging of the exceptions being handled by the Struts 2 framework you must specify some parameter values in struts.xml. If you examine the <a href="http://struts.apache.org/release/2.3.x/xwork-core/apidocs/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptor.html">ExceptionMappingInterceptor class API</a>^[http://struts.apache.org/release/2.3.x/xwork-core/apidocs/com/opensymphony/xwork2/interceptor/ExceptionMappingInterceptor.html] there are three parameter values you can set to enable logging (logEnabled), the log level to use (logLevel), and the log category (logCategory) to specify in the log message.</p>
+
+<p>To set these parameter values for all actions that use a specific stack of interceptors in a package include the following in struts.xml just after the opening package node.</p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>&lt;interceptors&gt;
+  &lt;interceptor-stack name="appDefaultStack"&gt;
+    &lt;interceptor-ref name="defaultStack"&gt;
+     &lt;param name="exception.logEnabled"&gt;true&lt;/param&gt;
+     &lt;param name="exception.logLevel"&gt;ERROR&lt;/param&gt;
+    &lt;/interceptor-ref&gt;
+ &lt;/interceptor-stack&gt;
+&lt;/interceptors&gt;
+
+&lt;default-interceptor-ref name="appDefaultStack" /&gt;
+
+
+</code></pre>
+</div>
+
+<p>The above interceptors node configures a new stack of Struts 2 interceptors named appDefaultStack. This stack of interceptors is based upon the defaultStack of interceptors (which are the Struts 2 interceptors that execute by default whenever an Action class method is called by the Struts 2 framework).</p>
+
+<p>The ExceptionMappingInterceptor is one of the Struts 2 interceptors that is part of the default stack. In the definition of the struts defaultStack, the ExceptionMappingInterceptor is given the name of exception. By specifying a param node with the name of exception.logEnabled and a value of true, I’m setting the logEnabled parameter of the ExceptionMappingInterceptor class to true.</p>
+
+<p>Now when the application throws an uncaught exception, the Struts 2 framework will handle it and will also write an entry to the log that includes the stack trace. In the example above, I’ve set the level to log these exceptions to be ERROR.</p>
+
+<p>In the example applications, the logging is just to the Servlet container’s console (see the log4j.xml file for the log settings).</p>
+
+<p>#####Display Exception Information In Browser#####</p>
+
+<p>You can display information about the exception in the browser if you want by using s:property tags with a value of exception and exceptionStack. For example in error.jsp is this markup.</p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>   &lt;h4&gt;The application has malfunctioned.&lt;/h4&gt;
+
+   &lt;p&gt;  Please contact technical support with the following information:&lt;/p&gt; 
+
+   &lt;h4&gt;Exception Name: &lt;s:property value="exception" /&gt; &lt;/h4&gt;
+
+   &lt;h4&gt;Exception Details: &lt;s:property value="exceptionStack" /&gt;&lt;/h4&gt; 
+
+
+</code></pre>
+</div>
+
+<p>When the exception interceptor is triggered it adds to the fields available for display the exception message and the exception’s stack trace.</p>
+
+<p>#####Summary#####</p>
+
+<p>Struts 2 provides a easy to use configuration for handling uncaught exceptions and redirecting users to appropriate view pages. You can configure exception handling to be global for all actions or to just for a specific action. You can also enable the Struts 2 framework to log the uncaught exceptions.</p>
+
+  </section>
+</article>
+
+
+<footer class="container">
+  <div class="col-md-12">
+    Copyright &copy; 2000-2016 <a href="http://www.apache.org/">The Apache Software Foundation </a>.
+    All Rights Reserved.
+  </div>
+  <div class="col-md-12">
+    Apache Struts, Struts, Apache, the Apache feather logo, and the Apache Struts project logos are
+    trademarks of The Apache Software Foundation.
+  </div>
+  <div class="col-md-12">Logo and website design donated by <a href="https://softwaremill.com/">SoftwareMill</a>.</div>
+</footer>
+
+<script>!function (d, s, id) {
+  var js, fjs = d.getElementsByTagName(s)[0];
+  if (!d.getElementById(id)) {
+    js = d.createElement(s);
+    js.id = id;
+    js.src = "//platform.twitter.com/widgets.js";
+    fjs.parentNode.insertBefore(js, fjs);
+  }
+}(document, "script", "twitter-wjs");</script>
+<script src="https://apis.google.com/js/platform.js" async="async" defer="defer"></script>
+
+<div id="fb-root"></div>
+
+<script>(function (d, s, id) {
+  var js, fjs = d.getElementsByTagName(s)[0];
+  if (d.getElementById(id)) return;
+  js = d.createElement(s);
+  js.id = id;
+  js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";
+  fjs.parentNode.insertBefore(js, fjs);
+}(document, 'script', 'facebook-jssdk'));</script>
+
+
+<script>
+$(function() {
+  return $("h2, h3, h4, h5, h6").each(function(i, el) {
+    var $el, icon, id;
+    $el = $(el);
+    id = $el.attr('id');
+    icon = '<i class="fa fa-link"></i>';
+    if (id) {
+      return $el.prepend($("<a />").addClass("header-link").attr("href", "#" + id).html(icon));
+    }
+  });
+});
+</script>
+
+</body>
+</html>

Added: websites/production/struts/content/getting-started/exclude-parameters.html
==============================================================================
--- websites/production/struts/content/getting-started/exclude-parameters.html (added)
+++ websites/production/struts/content/getting-started/exclude-parameters.html Fri Mar 31 05:44:39 2017
@@ -0,0 +1,286 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8"/>
+  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+  <meta name="Date-Revision-yyyymmdd" content="20140918"/>
+  <meta http-equiv="Content-Language" content="en"/>
+  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+
+  <title>Exclude parameters</title>
+
+  <link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,400italic,600italic,700italic" rel="stylesheet" type="text/css">
+  <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
+  <link href="/css/main.css" rel="stylesheet">
+  <link href="/css/custom.css" rel="stylesheet">
+
+  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
+  <script type="text/javascript" src="/bootstrap/js/bootstrap.js"></script>
+  <script type="text/javascript" src="/js/community.js"></script>
+</head>
+<body>
+
+<a href="http://github.com/apache/struts" class="github-ribbon">
+  <img style="position: absolute; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub">
+</a>
+
+<header>
+  <nav>
+    <div role="navigation" class="navbar navbar-default navbar-fixed-top">
+      <div class="container">
+        <div class="navbar-header">
+          <button type="button" data-toggle="collapse" data-target="#struts-menu" class="navbar-toggle">
+            Menu
+            <span class="sr-only">Toggle navigation</span>
+            <span class="icon-bar"></span>
+            <span class="icon-bar"></span>
+            <span class="icon-bar"></span>
+          </button>
+          <a href="/index.html" class="navbar-brand logo"><img src="/img/struts-logo.svg"></a>
+        </div>
+        <div id="struts-menu" class="navbar-collapse collapse">
+          <ul class="nav navbar-nav">
+            <li class="dropdown">
+              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+                Home<b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <li><a href="/index.html">Welcome</a></li>
+                <li><a href="/downloads.html">Downloads</a></li>
+                <li><a href="/announce.html">Announcements</a></li>
+                <li><a href="http://www.apache.org/licenses/">License</a></li>
+                <li><a href="http://apache.org/foundation/thanks.html">Thanks!</a></li>
+                <li><a href="http://apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+              </ul>
+            </li>
+            <li class="dropdown">
+              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+                Support<b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <li><a href="/mail.html">User Mailing List</a></li>
+                <li><a href="https://issues.apache.org/jira/browse/WW">Issue Tracker</a></li>
+                <li><a href="/security.html">Reporting Security Issues</a></li>
+                <li class="divider"></li>
+                <li><a href="/maven/project-info.html">Project info</a></li>
+                <li><a href="/maven/struts2-core/dependencies.html">Struts Core dependencies</a></li>
+                <li><a href="/maven/struts2-plugins/modules.html">Plugin dependencies</a></li>
+              </ul>
+            </li>
+            <li class="dropdown">
+              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+                Documentation<b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <li><a href="/birdseye.html">Birds Eye</a></li>
+                <li><a href="/primer.html">Key Technologies</a></li>
+                <li><a href="/kickstart.html">Kickstart FAQ</a></li>
+                <li><a href="https://cwiki.apache.org/confluence/display/WW/Home">Wiki</a></li>
+                <li class="divider"></li>
+                <li><a href="/docs/home.html">Getting started</a></li>
+                <li><a href="/docs/tutorials.html">Tutorials</a></li>
+                <li><a href="/docs/faqs.html">FAQs</a></li>
+                <li><a href="/docs/guides.html">Guides</a></li>
+                <li class="divider"></li>
+                <li><a href="/maven/struts2-core/apidocs/index.html">Struts Core API</a></li>
+                <li><a href="/docs/plugins.html">Plugin APIs</a></li>
+                <li><a href="/docs/tag-reference.html">Tag reference</a></li>
+                <li><a href="http://cwiki.apache.org/S2PLUGINS/home.html">Plugin registry</a></li>
+                <li class="divider"></li>
+                <li><a href="/getting-started/getting-started.html">Getting Started (WIP)</a></li>
+              </ul>
+            </li>
+            <li class="dropdown">
+              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+                Contributing<b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <li><a href="/youatstruts.html">You at Struts</a></li>
+                <li><a href="/helping.html">How to Help FAQ</a></li>
+                <li><a href="/dev-mail.html">Development Lists</a></li>
+                <li class="divider"></li>
+                <li><a href="/submitting-patches.html">Submitting patches</a></li>
+                <li><a href="/builds.html">Source Code</a></li>
+                <li><a href="/coding-standards.html">Coding standards</a></li>
+                <li class="divider"></li>
+                <li><a href="/releases.html">Release Guidelines</a></li>
+                <li><a href="/bylaws.html">PMC Charter</a></li>
+                <li><a href="/volunteers.html">Volunteers</a></li>
+                <li><a href="https://git-wip-us.apache.org/repos/asf?p=struts.git">Source Repository</a></li>
+              </ul>
+            </li>
+            <li class="apache"><a href="http://www.apache.org/"><img src="/img/apache.png"></a></li>
+          </ul>
+        </div>
+      </div>
+    </div>
+  </nav>
+</header>
+
+
+<article class="container">
+  <section class="col-md-12">
+    <h2 id="exclude-parameters">Exclude Parameters</h2>
+
+<p>The example code for this tutorial, exclude_parameters, is available at <a href="https://github.com/apache/struts-examples">https://github.com/apache/struts-examples</a>.</p>
+
+<p>#####Introduction#####</p>
+
+<p>When <a href="http://struts.apache.org/2.3.8/docs/strutsproperties.html">Struts development mode is set to true</a>^[http://struts.apache.org/2.3.8/docs/strutsproperties.html] (also see <a href="#PAGE_16941310">Debugging Struts</a>) the framework writes many informative messages to the log file. These messages include ones that indicate whether or not a specific parameter will be handled by the parameter interceptor and made available to the Action class. These log messages can be helpful in clearly identifying parameters that you do not want the parameter interceptor to process for security or other reasons. This article discusses how to exclude parameters from being handled by the parameter interceptor.</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>#####Processing Request Parameters#####</p>
+
+<p>Most request parameters are by default processed by the parameter interceptor and Struts 2 will attempt to modify the state of those Action class fields that match up to a parameter name by calling a corresponding public set method. For example if the request includes a parameter of lastName with a value of Phillips, Struts 2 will try to call a public method with a signature of setLastName(String lastName). However, there may be request parameters that you do not want Struts 2 to try to set the value of in the Action class.</p>
+
+<p>Consider this code which creates a form:</p>
+
+<p><strong>Struts 2 Form Tags</strong></p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>&lt;s:form action="save" method="post"&gt;
+&lt;s:textfield key="personBean.firstName" /&gt; 
+&lt;s:textfield key="personBean.lastName" /&gt; 
+&lt;s:textfield key="personBean.email" /&gt;
+&lt;s:textfield key="personBean.phoneNumber" /&gt;
+&lt;s:select key="personBean.sport" list="sports" /&gt;
+&lt;s:radio key="personBean.gender" list="genders" /&gt;
+&lt;s:select key="personBean.residency" list="states" listKey="stateAbbr" listValue="stateName" /&gt;
+&lt;s:checkbox key="personBean.over21" /&gt;
+&lt;s:checkboxlist key="personBean.carModels" list="carModelsAvailable" /&gt;
+&lt;s:submit key="submit" /&gt;
+&lt;/s:form&gt;
+
+
+</code></pre>
+</div>
+
+<p>The s:submit tag will create a submit button with a name of submit. Since the Action class probably doesn’t have a setSubmit(String name) method you will see the following log messages (only if Struts development mode is set to true):</p>
+
+<p><strong>Log Messages</strong></p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>Dec 31, 2012 3:43:53 PM 
+com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
+WARNING: Parameter [submit] is not on the excludeParams list of patterns and will be appended to action!
+
+Dec 31, 2012 3:43:53 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
+SEVERE: Developer Notification (set struts.devMode to false to disable this message):
+Unexpected Exception caught setting 'submit' on 'class org.apache.struts.edit.action.EditAction: Error setting expression 'submit' with value ['Save Changes', ]
+
+
+</code></pre>
+</div>
+
+<p>#####Excluding Request Parameters From Struts 2 Processing#####</p>
+
+<p>If you’re not familiar with setting up a custom interceptor stack for your Struts 2 application review <a href="#PAGE_24187261">Introducing Interceptors</a>.</p>
+
+<table>
+  <tbody>
+    <tr>
+    </tr>
+  </tbody>
+</table>
+
+<p>To exclude specific parameters from being processed by the Struts 2 framework you need to add those parameter names to the list of excluded parameters. One way to do this is by adding those parameter names to the collection of excludedParams for the Parameters interceptor. You can do this by modifying the Parameters interceptor in setting up the stack of interceptors used by your Struts 2 application. For example:</p>
+
+<p><strong>Setup Interceptor Stack To Exclude submit Parameter</strong></p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>&lt;interceptors&gt;
+  &lt;interceptor-stack name="appDefault"&gt;
+    &lt;interceptor-ref name="defaultStack"&gt;
+       &lt;param name="exception.logEnabled"&gt;true&lt;/param&gt;
+       &lt;param name="exception.logLevel"&gt;ERROR&lt;/param&gt;
+       &lt;param name="params.excludeParams"&gt;dojo..*,^struts..*,^session..*,^request..*,^application..*,^servlet(Request|Response)..*,parameters...*,submit&lt;/param&gt;
+    &lt;/interceptor-ref&gt;
+  &lt;/interceptor-stack&gt;
+&lt;/interceptors&gt;
+		
+&lt;default-interceptor-ref name="appDefault" /&gt;
+
+
+</code></pre>
+</div>
+
+<p>The value of node &lt;param name=”params.excludeParams”&gt; is a comma-delimited list of regular expressions or simple Strings that identify request parameters that should NOT be processed by the Parameters interceptor. To exclude the submit parameter (which is the name of the submit button in the form code above), I just added submit to the list.</p>
+
+<p>See the <a href="http://struts.apache.org/2.3.8/docs/struts-defaultxml.html">Basic Stack of Interceptors described here</a>^[http://struts.apache.org/2.3.8/docs/struts-defaultxml.html] to view the initial set of parameter names/regular expressions to exclude. Be sure to copy over the list of parameters already being excluded and then add your own parameters to the end separated by commas.</p>
+
+<p>#####Example Application#####</p>
+
+<p>Download the example application, <a href="http://code.google.com/p/struts2-examples/downloads/list">Exclude_Params_Struts2_Mvn</a>^[http://code.google.com/p/struts2-examples/downloads/list] that demonstrates excluding a request parameter. The download is a zipped Maven project. You should be able to unzip it and import the project into any Maven-aware Java IDE. See the project’s README.txt file for how to build and run the application.</p>
+
+<p>To see the log messages written when not excluding the submit parameter remove the “,submit” from the list of excluded parameter values in the struts.xml file. Then rebuild and redeploy the application and view the console when running the application.</p>
+
+<p>#####Summary#####</p>
+
+<p>It’s a nice feature of the Struts 2 framework that it logs during development which request parameters will and will not be processed. During development of a Struts 2 web application it’s a good practice to review these log messages to determine if there are any parameters that the framework should not process. For those parameters the Struts 2 framework should not process add the parameter name (or a regular expression that can be used to identify multiple parameter names) to the comma-delimited list that is the value for the &lt;param name=”params.excludeParams”&gt; node.</p>
+
+  </section>
+</article>
+
+
+<footer class="container">
+  <div class="col-md-12">
+    Copyright &copy; 2000-2016 <a href="http://www.apache.org/">The Apache Software Foundation </a>.
+    All Rights Reserved.
+  </div>
+  <div class="col-md-12">
+    Apache Struts, Struts, Apache, the Apache feather logo, and the Apache Struts project logos are
+    trademarks of The Apache Software Foundation.
+  </div>
+  <div class="col-md-12">Logo and website design donated by <a href="https://softwaremill.com/">SoftwareMill</a>.</div>
+</footer>
+
+<script>!function (d, s, id) {
+  var js, fjs = d.getElementsByTagName(s)[0];
+  if (!d.getElementById(id)) {
+    js = d.createElement(s);
+    js.id = id;
+    js.src = "//platform.twitter.com/widgets.js";
+    fjs.parentNode.insertBefore(js, fjs);
+  }
+}(document, "script", "twitter-wjs");</script>
+<script src="https://apis.google.com/js/platform.js" async="async" defer="defer"></script>
+
+<div id="fb-root"></div>
+
+<script>(function (d, s, id) {
+  var js, fjs = d.getElementsByTagName(s)[0];
+  if (d.getElementById(id)) return;
+  js = d.createElement(s);
+  js.id = id;
+  js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";
+  fjs.parentNode.insertBefore(js, fjs);
+}(document, 'script', 'facebook-jssdk'));</script>
+
+
+<script>
+$(function() {
+  return $("h2, h3, h4, h5, h6").each(function(i, el) {
+    var $el, icon, id;
+    $el = $(el);
+    id = $el.attr('id');
+    icon = '<i class="fa fa-link"></i>';
+    if (id) {
+      return $el.prepend($("<a />").addClass("header-link").attr("href", "#" + id).html(icon));
+    }
+  });
+});
+</script>
+
+</body>
+</html>

Added: websites/production/struts/content/getting-started/form-tags.html
==============================================================================
--- websites/production/struts/content/getting-started/form-tags.html (added)
+++ websites/production/struts/content/getting-started/form-tags.html Fri Mar 31 05:44:39 2017
@@ -0,0 +1,421 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8"/>
+  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+  <meta name="Date-Revision-yyyymmdd" content="20140918"/>
+  <meta http-equiv="Content-Language" content="en"/>
+  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+
+  <title>Form tags</title>
+
+  <link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,400italic,600italic,700italic" rel="stylesheet" type="text/css">
+  <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
+  <link href="/css/main.css" rel="stylesheet">
+  <link href="/css/custom.css" rel="stylesheet">
+
+  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
+  <script type="text/javascript" src="/bootstrap/js/bootstrap.js"></script>
+  <script type="text/javascript" src="/js/community.js"></script>
+</head>
+<body>
+
+<a href="http://github.com/apache/struts" class="github-ribbon">
+  <img style="position: absolute; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub">
+</a>
+
+<header>
+  <nav>
+    <div role="navigation" class="navbar navbar-default navbar-fixed-top">
+      <div class="container">
+        <div class="navbar-header">
+          <button type="button" data-toggle="collapse" data-target="#struts-menu" class="navbar-toggle">
+            Menu
+            <span class="sr-only">Toggle navigation</span>
+            <span class="icon-bar"></span>
+            <span class="icon-bar"></span>
+            <span class="icon-bar"></span>
+          </button>
+          <a href="/index.html" class="navbar-brand logo"><img src="/img/struts-logo.svg"></a>
+        </div>
+        <div id="struts-menu" class="navbar-collapse collapse">
+          <ul class="nav navbar-nav">
+            <li class="dropdown">
+              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+                Home<b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <li><a href="/index.html">Welcome</a></li>
+                <li><a href="/downloads.html">Downloads</a></li>
+                <li><a href="/announce.html">Announcements</a></li>
+                <li><a href="http://www.apache.org/licenses/">License</a></li>
+                <li><a href="http://apache.org/foundation/thanks.html">Thanks!</a></li>
+                <li><a href="http://apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+              </ul>
+            </li>
+            <li class="dropdown">
+              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+                Support<b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <li><a href="/mail.html">User Mailing List</a></li>
+                <li><a href="https://issues.apache.org/jira/browse/WW">Issue Tracker</a></li>
+                <li><a href="/security.html">Reporting Security Issues</a></li>
+                <li class="divider"></li>
+                <li><a href="/maven/project-info.html">Project info</a></li>
+                <li><a href="/maven/struts2-core/dependencies.html">Struts Core dependencies</a></li>
+                <li><a href="/maven/struts2-plugins/modules.html">Plugin dependencies</a></li>
+              </ul>
+            </li>
+            <li class="dropdown">
+              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+                Documentation<b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <li><a href="/birdseye.html">Birds Eye</a></li>
+                <li><a href="/primer.html">Key Technologies</a></li>
+                <li><a href="/kickstart.html">Kickstart FAQ</a></li>
+                <li><a href="https://cwiki.apache.org/confluence/display/WW/Home">Wiki</a></li>
+                <li class="divider"></li>
+                <li><a href="/docs/home.html">Getting started</a></li>
+                <li><a href="/docs/tutorials.html">Tutorials</a></li>
+                <li><a href="/docs/faqs.html">FAQs</a></li>
+                <li><a href="/docs/guides.html">Guides</a></li>
+                <li class="divider"></li>
+                <li><a href="/maven/struts2-core/apidocs/index.html">Struts Core API</a></li>
+                <li><a href="/docs/plugins.html">Plugin APIs</a></li>
+                <li><a href="/docs/tag-reference.html">Tag reference</a></li>
+                <li><a href="http://cwiki.apache.org/S2PLUGINS/home.html">Plugin registry</a></li>
+                <li class="divider"></li>
+                <li><a href="/getting-started/getting-started.html">Getting Started (WIP)</a></li>
+              </ul>
+            </li>
+            <li class="dropdown">
+              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+                Contributing<b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <li><a href="/youatstruts.html">You at Struts</a></li>
+                <li><a href="/helping.html">How to Help FAQ</a></li>
+                <li><a href="/dev-mail.html">Development Lists</a></li>
+                <li class="divider"></li>
+                <li><a href="/submitting-patches.html">Submitting patches</a></li>
+                <li><a href="/builds.html">Source Code</a></li>
+                <li><a href="/coding-standards.html">Coding standards</a></li>
+                <li class="divider"></li>
+                <li><a href="/releases.html">Release Guidelines</a></li>
+                <li><a href="/bylaws.html">PMC Charter</a></li>
+                <li><a href="/volunteers.html">Volunteers</a></li>
+                <li><a href="https://git-wip-us.apache.org/repos/asf?p=struts.git">Source Repository</a></li>
+              </ul>
+            </li>
+            <li class="apache"><a href="http://www.apache.org/"><img src="/img/apache.png"></a></li>
+          </ul>
+        </div>
+      </div>
+    </div>
+  </nav>
+</header>
+
+
+<article class="container">
+  <section class="col-md-12">
+    <h2 id="form-tags">Form Tags</h2>
+
+<p>The example code for this tutorial, form_tags, can be checked out from <a href="https://github.com/apache/struts-examples">https://github.com/apache/struts-examples</a>.</p>
+
+<blockquote>
+
+</blockquote>
+
+<p>#####Introduction#####</p>
+
+<p>In this tutorial we’ll explore some of the other Struts 2 form controls. In our previous tutorials that explained how to use Struts 2 forms (<em>Processing Forms</em> , <em>Form Validation</em> , and <em>Message Resource Files</em> ) we covered how to use the Struts 2 head, form, textfield controls and the key attribute. This tutorial will explore using the Struts 2 select, radio, checkbox, and checkboxlist form controls.</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>#####Example Application#####</p>
+
+<p>The example application that supports this tutorial shows how to use Struts 2 form tags so that a user can edit his information. The information that can be edited is encapsulated in an object of class Person. A Person object knows these things: first name, last name, favorite sport, gender, state of residency, is or is not over 21, and car models owned.</p>
+
+<p>To enable the user to edit his information that is stored in the Person object, we need to create a form like this one:</p>
+
+<p><img src="attachments/att19660802_Screen shot 2010-04-25 at 8.39.59 AM.png" alt="Screen shot 2010-04-25 at 8.39.59 AM.png" /></p>
+
+<p>The form allows the user to make changes. After submitting the form, the Struts 2 framework will update the state of the Person object.</p>
+
+<p>The first and last names are shown on the form (see edit.jsp) using the Struts 2 textfield tag, which we’ve discussed in previous tutorials.</p>
+
+<p>#####Struts 2 Select Tag#####</p>
+
+<p>A user can select one favorite sport from several choices. The example application uses the Struts 2 select tag to provide the list of options for the select box.</p>
+
+<p><strong>Struts 2 Select Tag</strong></p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>&lt;s:select key="personBean.sport" list="sports" /&gt;
+
+
+</code></pre>
+</div>
+
+<p>In these form tags, we are using the key attribute as discussed in the <em>Message Resource Files</em>  tutorial. The key attribute is used by the Struts 2 framework to determine values for the other attributes (e.g. label and value). We are also using a property file associated with the EditAction class to provide the label values based on the key attribute value (see the <em>Message Resource Files</em>  tutorial for information on using Struts 2 property files).</p>
+
+<blockquote>
+
+</blockquote>
+
+<blockquote>
+
+</blockquote>
+
+<blockquote>
+  <p>Note that there are many attributes for the Struts 2 form tags, most of which mirror the HTML attributes associated with the tags. You can read about all the attributes for a Struts 2 form tag by consulting the Struts 2 documentation.</p>
+</blockquote>
+
+<blockquote>
+
+</blockquote>
+
+<p>The value of the list attribute of the Struts 2 select tag is used by the framework to determine what method of the action class to call in order to create the option values. In our example application, the list attribute value of “sports” results in the framework calling the getSports method of class EditAction. That method returns a String array containing “football”, “baseball”, and “basketball”. Those values are used to create the option tags inside the select tag.</p>
+
+<p>The Struts 2 framework determines which option is preselected by using the key attribute’s value to call a method on the personBean object. Since the key attribute’s value is “personBean.sport”, the framework calls the personBean object’s getSport method. If the value returned by that method matches one of the option values, that option will be marked as “selected”.</p>
+
+<p>Here is the HTML that results from using the above Struts 2 select tag.</p>
+
+<p><strong>HTML Created By Struts 2 Select Tag</strong></p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>&lt;tr&gt;
+&lt;td class="tdLabel"&gt;
+&lt;label for="save_personBean_sport" class="label"&gt;Favorite sport:&lt;/label&gt;
+&lt;/td&gt;
+&lt;td&gt;
+&lt;select name="personBean.sport" id="save_personBean_sport"&gt;
+    &lt;option value="football"&gt;football&lt;/option&gt;
+    &lt;option value="baseball"&gt;baseball&lt;/option&gt;
+    &lt;option value="basketball" selected="selected"&gt;basketball&lt;/option&gt;
+&lt;/select&gt;
+&lt;/td&gt;
+&lt;/tr&gt;
+
+
+</code></pre>
+</div>
+
+<p>Note the table formatting created by the Struts 2 framework when using the Struts 2 select tag. The CSS classes are defined in style sheets included by the Struts 2 s:head tag. The Struts 2 s:head tag is placed inside the edit.jsp’s head section.</p>
+
+<p>Since the personBean’s getSport method returns “baskeball”, the basketball option value is marked as selected.</p>
+
+<p>#####Struts 2 Radio Tag#####</p>
+
+<p>The Struts 2 radio tag—like its standard HTML counterpart—is used to display 2 or more choices, only one of which can be selected by the user. Here is the code for the Struts 2 radio button from the example application.</p>
+
+<p><strong>Struts 2 Radio Tag</strong></p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>&lt;s:radio key="personBean.gender" list="genders" /&gt;
+
+
+</code></pre>
+</div>
+
+<p>Again the key attribute’s value determines the value for the label and value attributes. The label’s text is derived from the EditAction.properties file (key personBean.gender). Just like the Struts 2 select tag, the list attribute of the Struts 2 radio tag causes the framework to call the getGenders method of the EditAction class. The Array of String objects returned are used to create the individual radio buttons.</p>
+
+<p><strong>HTML Created By Struts 2 Radio Tag</strong></p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>&lt;tr&gt;
+&lt;td class="tdLabel"&gt;
+&lt;label for="save_personBean_gender" class="label"&gt;Gender:&lt;/label&gt;&lt;/td&gt;
+&lt;td&gt;
+&lt;input type="radio" name="personBean.gender" id="save_personBean_gendermale" value="male"/&gt;&lt;label for="save_personBean_gendermale"&gt;male&lt;/label&gt;
+&lt;input type="radio" name="personBean.gender" id="save_personBean_genderfemale" value="female"/&gt;&lt;label for="save_personBean_genderfemale"&gt;female&lt;/label&gt;
+&lt;input type="radio" name="personBean.gender" id="save_personBean_gendernot sure" checked="checked" value="not sure"/&gt;&lt;label for="save_personBean_gendernot sure"&gt;not sure&lt;/label&gt;
+&lt;/td&gt;
+&lt;/tr&gt;
+
+
+</code></pre>
+</div>
+
+<p>Also just like the Struts 2 select tag the result returned by calling the personBean object’s getGender method is used to determine which of the radio buttons is checked.</p>
+
+<p>#####Struts 2 Select Tag - Object Backed#####</p>
+
+<p>You may need to create a Struts 2 select tag where the options displayed to the user each have their own value that is different then what is displayed. In the example application, the user’s residency is stored as a two-letter abbreviation (e.g. KS), but the form select box should display the full state name (e.g. Kansas). To create such a select box in Struts 2, you would use this code</p>
+
+<p><strong>Struts 2 Select Tag Object Backed</strong></p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>&lt;s:select key="personBean.residency" list="states" listKey="stateAbbr" listValue="stateName" /&gt;
+
+
+</code></pre>
+</div>
+
+<p>The list value tells the framework to call the getStates method of the EditAction class. That method returns an ArrayList of State objects. Each State object has getStateAbbr and getStateName methods.</p>
+
+<p>The listKey attribute tells the framework to use the value returned by calling the getStateAbbr method as the value for the value attribute of the HTML option tag and the value returned by calling the getStateName method as the value displayed to the user. So the above Struts 2 select tag code results in this HTML.</p>
+
+<p><strong>HTML Created By Struts 2 Select Tag</strong></p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>&lt;tr&gt;
+&lt;td class="tdLabel"&gt;
+&lt;label for="save_personBean_residency" class="label"&gt;State resident:&lt;/label&gt;&lt;/td&gt;
+&lt;td&gt;
+&lt;select name="personBean.residency" id="save_personBean_residency"&gt;
+    &lt;option value="AZ"&gt;Arizona&lt;/option&gt;
+    &lt;option value="CA"&gt;California&lt;/option&gt;
+    &lt;option value="FL"&gt;Florida&lt;/option&gt;
+    &lt;option value="KS" selected="selected"&gt;Kansas&lt;/option&gt;
+    &lt;option value="NY"&gt;New York&lt;/option&gt;
+&lt;/select&gt;
+&lt;/td&gt;
+&lt;/tr&gt;
+
+
+</code></pre>
+</div>
+
+<p>The value returned by calling the personBean object’s getResidency method determines which of the select tag’s option tags is marked as selected. In our example, since getResidency returns “KS”, the option tag whose value attribute equals “KS” is marked as selected.</p>
+
+<p>#####Struts 2 Checkbox Tag#####</p>
+
+<p>The Struts 2 checkbox tag is used to create the HTML input type equals checkbox tag. The value for the key attribute tells the framework what method to call to determine if the checkbox is checked or not checked. The method called should return a Boolean value (true or false). A return value of true will cause the checkbox to be checked and false the checkbox will not be checked.</p>
+
+<p><strong>Struts 2 Checkbox Tag</strong></p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>&lt;s:checkbox key="personBean.over21" /&gt;
+
+
+</code></pre>
+</div>
+
+<p>Since the method getOver21 returns true, the checkbox is checked.</p>
+
+<p><strong>HTML Created By Struts 2 Checkbox Tag</strong></p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>&lt;tr&gt;
+&lt;td valign="top" align="right"&gt;
+&lt;/td&gt;
+&lt;td valign="top" align="left"&gt;
+&lt;input type="checkbox" name="personBean.over21" value="true" checked="checked" id="save_personBean_over21"/&gt;
+&lt;input type="hidden" id="__checkbox_save_personBean_over21" name="__checkbox_personBean.over21" value="true" /&gt;  &lt;label for="save_personBean_over21" class="checkboxLabel"&gt;21 or older&lt;/label&gt;
+&lt;/td&gt;
+&lt;/tr&gt;
+
+
+</code></pre>
+</div>
+
+<p>When the form is submitted and the checkbox is not checked, no value will be posted for the checkbox (this is how HTML forms work). Since the Struts 2 framework will need to update the value of the personBean’s over21 instance field to false—given that the check box was not checked—the framework needs a way to determine if the checkbox was not checked after form submission.</p>
+
+<p>If you examine the HTML code created by the Struts 2 checkbox tag, you’ll see that it created a hidden field associated with the personBean.over21 checkbox. When the Struts 2 framework intercepts the submission of this form it will use this hidden form field to check if the associated checkbox field exists in the posted form data. If that checkbox field doesn’t exist then the Struts 2 framework will know to update the value of the personBean object’s over21 instance variable to false.</p>
+
+<p>#####Struts 2 checkboxlist Tag#####</p>
+
+<p>The Struts 2 framework provides a unique form field control that creates a series of associated check boxes, one or more of which can be checked. In the example application, the Person class has an Array of Strings, which is used to store car models owned by a person.</p>
+
+<p>Using the Struts 2 checkbox tag, we can create a series of checkboxes, one for each possible car model the user may own. The value of each String in the personBean’s carModels Array will determine which checkboxes are checked.</p>
+
+<p><strong>Struts 2 Checkboxlist Tag</strong></p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>&lt;s:checkboxlist key="personBean.carModels" list="carModelsAvailable" /&gt;
+
+
+</code></pre>
+</div>
+
+<p>The list attributes value in the checkboxlist tag tells the Struts 2 framework which method to call to get the possible car models. In the example application, the framework will call the EditAction class’s getCarModelsAvailable method. That method returns an Array of Strings. For each element of the Array, the Struts 2 framework creates a checkbox (including the associated hidden field described above).</p>
+
+<p>The key attribute value in the checkboxlist tag tells the Struts 2 framework which method to call on the personBean object to determine which checkboxes should be checked. In the example application, the framework will call the personBean object’s getCarModels method. The getCarModels method returns an Array of Strings. For each String value in that Array that matches a String value in the Array returned by the EditAction class’s getCarModelsAvailable, the checkbox will be checked.</p>
+
+<p><strong>HTML Created By Struts 2 Checkboxlist Tag</strong></p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>&lt;tr&gt;
+&lt;td class="tdLabel"&gt;
+&lt;label for="save_personBean_carModels" class="label"&gt;Car models owned:&lt;/label&gt;&lt;/td&gt;
+&lt;td&gt;
+&lt;input type="checkbox" name="personBean.carModels" value="Ford" id="personBean.carModels-1" checked="checked"/&gt;
+&lt;label for="personBean.carModels-1" class="checkboxLabel"&gt;Ford&lt;/label&gt;
+&lt;input type="checkbox" name="personBean.carModels" value="Chrysler" id="personBean.carModels-2"/&gt;
+&lt;label for="personBean.carModels-2" class="checkboxLabel"&gt;Chrysler&lt;/label&gt;
+&lt;input type="checkbox" name="personBean.carModels" value="Toyota" id="personBean.carModels-3"/&gt;
+&lt;label for="personBean.carModels-3" class="checkboxLabel"&gt;Toyota&lt;/label&gt;
+&lt;input type="checkbox" name="personBean.carModels" value="Nissan" id="personBean.carModels-4" checked="checked"/&gt;
+&lt;label for="personBean.carModels-4" class="checkboxLabel"&gt;Nissan&lt;/label&gt;
+&lt;input type="hidden" id="__multiselect_save_personBean_carModels" name="__multiselect_personBean.carModels" value="" /&gt;
+&lt;/td&gt;
+&lt;/tr&gt;
+
+
+</code></pre>
+</div>
+
+<p>Summary
+ There are several other Struts 2 form controls you should explore. If you need more information about the Struts 2 form tags consult the Struts 2 documentation at <a href="http://struts.apache.org">http://struts.apache.org</a>.</p>
+
+  </section>
+</article>
+
+
+<footer class="container">
+  <div class="col-md-12">
+    Copyright &copy; 2000-2016 <a href="http://www.apache.org/">The Apache Software Foundation </a>.
+    All Rights Reserved.
+  </div>
+  <div class="col-md-12">
+    Apache Struts, Struts, Apache, the Apache feather logo, and the Apache Struts project logos are
+    trademarks of The Apache Software Foundation.
+  </div>
+  <div class="col-md-12">Logo and website design donated by <a href="https://softwaremill.com/">SoftwareMill</a>.</div>
+</footer>
+
+<script>!function (d, s, id) {
+  var js, fjs = d.getElementsByTagName(s)[0];
+  if (!d.getElementById(id)) {
+    js = d.createElement(s);
+    js.id = id;
+    js.src = "//platform.twitter.com/widgets.js";
+    fjs.parentNode.insertBefore(js, fjs);
+  }
+}(document, "script", "twitter-wjs");</script>
+<script src="https://apis.google.com/js/platform.js" async="async" defer="defer"></script>
+
+<div id="fb-root"></div>
+
+<script>(function (d, s, id) {
+  var js, fjs = d.getElementsByTagName(s)[0];
+  if (d.getElementById(id)) return;
+  js = d.createElement(s);
+  js.id = id;
+  js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";
+  fjs.parentNode.insertBefore(js, fjs);
+}(document, 'script', 'facebook-jssdk'));</script>
+
+
+<script>
+$(function() {
+  return $("h2, h3, h4, h5, h6").each(function(i, el) {
+    var $el, icon, id;
+    $el = $(el);
+    id = $el.attr('id');
+    icon = '<i class="fa fa-link"></i>';
+    if (id) {
+      return $el.prepend($("<a />").addClass("header-link").attr("href", "#" + id).html(icon));
+    }
+  });
+});
+</script>
+
+</body>
+</html>

Added: websites/production/struts/content/getting-started/form-validation-using-xml.html
==============================================================================
--- websites/production/struts/content/getting-started/form-validation-using-xml.html (added)
+++ websites/production/struts/content/getting-started/form-validation-using-xml.html Fri Mar 31 05:44:39 2017
@@ -0,0 +1,336 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8"/>
+  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+  <meta name="Date-Revision-yyyymmdd" content="20140918"/>
+  <meta http-equiv="Content-Language" content="en"/>
+  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+
+  <title>Form validation using XML</title>
+
+  <link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,400italic,600italic,700italic" rel="stylesheet" type="text/css">
+  <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
+  <link href="/css/main.css" rel="stylesheet">
+  <link href="/css/custom.css" rel="stylesheet">
+
+  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
+  <script type="text/javascript" src="/bootstrap/js/bootstrap.js"></script>
+  <script type="text/javascript" src="/js/community.js"></script>
+</head>
+<body>
+
+<a href="http://github.com/apache/struts" class="github-ribbon">
+  <img style="position: absolute; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub">
+</a>
+
+<header>
+  <nav>
+    <div role="navigation" class="navbar navbar-default navbar-fixed-top">
+      <div class="container">
+        <div class="navbar-header">
+          <button type="button" data-toggle="collapse" data-target="#struts-menu" class="navbar-toggle">
+            Menu
+            <span class="sr-only">Toggle navigation</span>
+            <span class="icon-bar"></span>
+            <span class="icon-bar"></span>
+            <span class="icon-bar"></span>
+          </button>
+          <a href="/index.html" class="navbar-brand logo"><img src="/img/struts-logo.svg"></a>
+        </div>
+        <div id="struts-menu" class="navbar-collapse collapse">
+          <ul class="nav navbar-nav">
+            <li class="dropdown">
+              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+                Home<b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <li><a href="/index.html">Welcome</a></li>
+                <li><a href="/downloads.html">Downloads</a></li>
+                <li><a href="/announce.html">Announcements</a></li>
+                <li><a href="http://www.apache.org/licenses/">License</a></li>
+                <li><a href="http://apache.org/foundation/thanks.html">Thanks!</a></li>
+                <li><a href="http://apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+              </ul>
+            </li>
+            <li class="dropdown">
+              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+                Support<b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <li><a href="/mail.html">User Mailing List</a></li>
+                <li><a href="https://issues.apache.org/jira/browse/WW">Issue Tracker</a></li>
+                <li><a href="/security.html">Reporting Security Issues</a></li>
+                <li class="divider"></li>
+                <li><a href="/maven/project-info.html">Project info</a></li>
+                <li><a href="/maven/struts2-core/dependencies.html">Struts Core dependencies</a></li>
+                <li><a href="/maven/struts2-plugins/modules.html">Plugin dependencies</a></li>
+              </ul>
+            </li>
+            <li class="dropdown">
+              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+                Documentation<b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <li><a href="/birdseye.html">Birds Eye</a></li>
+                <li><a href="/primer.html">Key Technologies</a></li>
+                <li><a href="/kickstart.html">Kickstart FAQ</a></li>
+                <li><a href="https://cwiki.apache.org/confluence/display/WW/Home">Wiki</a></li>
+                <li class="divider"></li>
+                <li><a href="/docs/home.html">Getting started</a></li>
+                <li><a href="/docs/tutorials.html">Tutorials</a></li>
+                <li><a href="/docs/faqs.html">FAQs</a></li>
+                <li><a href="/docs/guides.html">Guides</a></li>
+                <li class="divider"></li>
+                <li><a href="/maven/struts2-core/apidocs/index.html">Struts Core API</a></li>
+                <li><a href="/docs/plugins.html">Plugin APIs</a></li>
+                <li><a href="/docs/tag-reference.html">Tag reference</a></li>
+                <li><a href="http://cwiki.apache.org/S2PLUGINS/home.html">Plugin registry</a></li>
+                <li class="divider"></li>
+                <li><a href="/getting-started/getting-started.html">Getting Started (WIP)</a></li>
+              </ul>
+            </li>
+            <li class="dropdown">
+              <a data-toggle="dropdown" href="#" class="dropdown-toggle">
+                Contributing<b class="caret"></b>
+              </a>
+              <ul class="dropdown-menu">
+                <li><a href="/youatstruts.html">You at Struts</a></li>
+                <li><a href="/helping.html">How to Help FAQ</a></li>
+                <li><a href="/dev-mail.html">Development Lists</a></li>
+                <li class="divider"></li>
+                <li><a href="/submitting-patches.html">Submitting patches</a></li>
+                <li><a href="/builds.html">Source Code</a></li>
+                <li><a href="/coding-standards.html">Coding standards</a></li>
+                <li class="divider"></li>
+                <li><a href="/releases.html">Release Guidelines</a></li>
+                <li><a href="/bylaws.html">PMC Charter</a></li>
+                <li><a href="/volunteers.html">Volunteers</a></li>
+                <li><a href="https://git-wip-us.apache.org/repos/asf?p=struts.git">Source Repository</a></li>
+              </ul>
+            </li>
+            <li class="apache"><a href="http://www.apache.org/"><img src="/img/apache.png"></a></li>
+          </ul>
+        </div>
+      </div>
+    </div>
+  </nav>
+</header>
+
+
+<article class="container">
+  <section class="col-md-12">
+    <h2 id="form-validation-using-xml">Form Validation Using XML</h2>
+
+<p>The example code for this tutorial, form_xml_validation, 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>In this tutorial we’ll cover how to validate a user’s input in form fields using Struts 2’s XML validation methodology. In the <em>Form Validation</em>  tutorial we discussed validating a user’s input using the validate method in the Action class. Using a separate XML validation file gives you the ability to use validators built-in to the Struts 2 framework.</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>#####Example Application#####</p>
+
+<p>The example application that supports this tutorial shows how to use Struts 2’s XML validation methodology. The information that can be edited is encapsulated in an object of class Person.</p>
+
+<p>To enable the user to edit his information that is stored in the Person object, we have this form:</p>
+
+<p><img src="attachments/att20873263_form-validation-1.png" alt="form-validation-1.png" /></p>
+
+<p>When the user submits the form, we want to validate his entries into the form fields.</p>
+
+<p>#####Validation Using XML#####</p>
+
+<p>To validate a user’s form field entries you can use a separate XML file that contains your validation rules. The XML file that contains the validation rules must be named as ActionClassName-validation.xml. In the example application, the XML validation file is named EditAction-validation.xml (see src/main/resources/org/apache/struts/edit/action).</p>
+
+<p>Struts 2 provides several different validators that you can use in the XML validation file. See <em>Validation</em>  for a list of validators you can employ.</p>
+
+<p>In the above form, we want to ensure the user enters a first name. To have the Struts 2 framework enforce that rule we can used the Struts 2 <em>requiredstring validator</em> . This validator checks that the user has entered a string value in the form field.</p>
+
+<p>#####XML Validator Format#####</p>
+
+<p>In the XML validation file (for this example that is EditAction-validation.xml), is this XML:</p>
+
+<p><strong>XML Validator Required String</strong></p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code><span class="cp">&lt;!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"&gt;</span>
+
+<span class="nt">&lt;validators&gt;</span>
+ <span class="nt">&lt;validator</span> <span class="na">type=</span><span class="s">"requiredstring"</span><span class="nt">&gt;</span>
+ 	<span class="nt">&lt;param</span> <span class="na">name=</span><span class="s">"fieldname"</span><span class="nt">&gt;</span>personBean.firstName<span class="nt">&lt;/param&gt;</span>
+ 	<span class="nt">&lt;message&gt;</span>First name is required.<span class="nt">&lt;/message&gt;</span>
+ <span class="nt">&lt;/validator&gt;</span>
+<span class="nt">&lt;/validators&gt;</span>
+
+
+</code></pre>
+</div>
+
+<p>Within the validators node you can have 1 or more validator nodes. The type attribute specifies which validator you want the Struts 2 framework to use (see <em>Validation</em> ). The param name=”fieldname” node is used to tell the framework which form field entry to apply the rule to. See edit.jsp for the form fields and their name value (review <a href="#PAGE_19300595">Struts 2 Form Tags</a> if you’re not familiar with how to use Struts 2 form tags). The message node is used to tell the framework what message to display if the validation fails.</p>
+
+<table>
+  <tbody>
+    <tr>
+      <td>There are alternate ways to write the XML that goes in the validation XML file. See <em>Validation</em>  in the Struts 2 documentation for a full discussion.</td>
+    </tr>
+  </tbody>
+</table>
+
+<table>
+  <tbody>
+    <tr>
+    </tr>
+  </tbody>
+</table>
+
+<p>For example if the user doesn’t enter a value in the first name form field and clicks on the Save Changes button, he will see the following.</p>
+
+<p><img src="attachments/att20873264_form-validation-2.png" alt="form-validation-2.png" /></p>
+
+<p>#####Validating An Email Address#####</p>
+
+<p>You can use the Struts 2 <em>email validator</em>  to validate the user’s input in the email field. Here is the validator node that is in the EditAction-validation.xml file.</p>
+
+<p><strong>Email Validator</strong></p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code> &lt;validator type="requiredstring"&gt;
+ 	&lt;param name="fieldname"&gt;personBean.email&lt;/param&gt;
+ 	&lt;message&gt;Email address is required.&lt;/message&gt;
+ &lt;/validator&gt;
+ &lt;validator type="email"&gt;
+ 	&lt;param name="fieldname"&gt;personBean.email&lt;/param&gt;
+ 	&lt;message&gt;Email address not valid.&lt;/message&gt;
+ &lt;/validator&gt;
+
+
+</code></pre>
+</div>
+
+<p>Note that in the example, we are requiring the user to enter an email address and then validating the email address the user entered.</p>
+
+<p>#####Validating A User’s Input Using A Regular Expression#####</p>
+
+<p>The Struts 2 framework provides a powerful way to validate a user’s form field input by using the <em>regex validator</em> . In the example application, we want to ensure the user enters the phone number in the format 999-999-9999. We can use a regular expression and the <em>regex validator</em>  to enforce this rule.</p>
+
+<p><strong>REGEX Validator</strong></p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>&lt;validator type="requiredstring"&gt;
+ 	&lt;param name="fieldname"&gt;personBean.phoneNumber&lt;/param&gt;
+ 	&lt;message&gt;Phone number is required.&lt;/message&gt;
+ &lt;/validator&gt;
+&lt;validator type="regex"&gt;
+	&lt;param name="fieldname"&gt;personBean.phoneNumber&lt;/param&gt;
+	&lt;param name="regex"&gt;&lt;![CDATA[\d{3}-\d{3}-\d{4}]]&gt;&lt;/param&gt;
+	&lt;message&gt;Phone number must be entered as 999-999-9999.&lt;/message&gt;
+&lt;/validator&gt;
+
+
+</code></pre>
+</div>
+
+<p>The param name=”expression” node is used to specify the regular expression that will be applied to the user’s input. Note how the regular expression is contained within a CDATA section.</p>
+
+<p>#####Validating A User’s Input Using An OGNL Expression#####</p>
+
+<p>In the example application, we want to ensure the user checks at least one of the car model check boxes. To enforce this rule we can use the <em>fieldexpression validator</em> . Here’s the XML for that validator node.</p>
+
+<p><strong>FieldExpression Validator</strong></p>
+
+<div class="highlighter-rouge"><pre class="highlight"><code>&lt;validator type="fieldexpression"&gt;
+	&lt;param name="fieldname"&gt;personBean.carModels&lt;/param&gt;
+	&lt;param name="expression"&gt;&lt;![CDATA[personBean.carModels.length &gt; 0]]&gt;&lt;/param&gt;
+	&lt;message&gt;You must select at least one car model.&lt;/message&gt;
+&lt;/validator&gt;
+
+
+</code></pre>
+</div>
+
+<p>The param name=”expression” node contains an OGNL expression that evaluates to true or false. We haven’t previously discussed OGNL, which stands for Object-Graph Navigation Language (see <a href="http://www.opensymphony.com/ognl/">http://www.opensymphony.com/ognl/</a> and <em>OGNL</em> ). OGNL expressions can be evaluated by the Struts 2 framework as Java statements.</p>
+
+<p>In the above XML the value of the param name=”expression” node, personBean.carModels.length &gt; 0, will be evaluated by the framework as a Java statement. The part personBean.carModels tells the framework to call the getCarModels method of class Person. That method returns an Array. Since class Array has a length attribute, the framework will get the value of the length attribute of the Array returned by the getCarModels method.</p>
+
+<p>If the user did not check any of the check boxes, the Array returned by the getCarModels method will have a length value of 0. Since the complete OGNL expression will only evaluate to true if the length value is greater than 0, the validation fails. The user will see this.</p>
+
+<p><img src="attachments/att20873265_form-validation-3.png" alt="form-validation-3.png" /></p>
+
+<p>The fieldexpression validator is useful when doing conditional validation of a user’s input. If the OGNL expression doesn’t evaluate to true then the user’s input won’t be allowed.</p>
+
+<p>#####Summary#####</p>
+
+<p>The Struts 2 framework provides easy-to-use validation methodologies. You can add a validate method to the Action class or have a separate XML file with validation rules or you can use a combination of both methodologies.</p>
+
+  </section>
+</article>
+
+
+<footer class="container">
+  <div class="col-md-12">
+    Copyright &copy; 2000-2016 <a href="http://www.apache.org/">The Apache Software Foundation </a>.
+    All Rights Reserved.
+  </div>
+  <div class="col-md-12">
+    Apache Struts, Struts, Apache, the Apache feather logo, and the Apache Struts project logos are
+    trademarks of The Apache Software Foundation.
+  </div>
+  <div class="col-md-12">Logo and website design donated by <a href="https://softwaremill.com/">SoftwareMill</a>.</div>
+</footer>
+
+<script>!function (d, s, id) {
+  var js, fjs = d.getElementsByTagName(s)[0];
+  if (!d.getElementById(id)) {
+    js = d.createElement(s);
+    js.id = id;
+    js.src = "//platform.twitter.com/widgets.js";
+    fjs.parentNode.insertBefore(js, fjs);
+  }
+}(document, "script", "twitter-wjs");</script>
+<script src="https://apis.google.com/js/platform.js" async="async" defer="defer"></script>
+
+<div id="fb-root"></div>
+
+<script>(function (d, s, id) {
+  var js, fjs = d.getElementsByTagName(s)[0];
+  if (d.getElementById(id)) return;
+  js = d.createElement(s);
+  js.id = id;
+  js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";
+  fjs.parentNode.insertBefore(js, fjs);
+}(document, 'script', 'facebook-jssdk'));</script>
+
+
+<script>
+$(function() {
+  return $("h2, h3, h4, h5, h6").each(function(i, el) {
+    var $el, icon, id;
+    $el = $(el);
+    id = $el.attr('id');
+    icon = '<i class="fa fa-link"></i>';
+    if (id) {
+      return $el.prepend($("<a />").addClass("header-link").attr("href", "#" + id).html(icon));
+    }
+  });
+});
+</script>
+
+</body>
+</html>



Mime
View raw message