This is an automated email from the ASF dual-hosted git repository. git-site-role pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/struts-site.git
The following commit(s) were added to refs/heads/asf-site by this push: new b07a86d Updates production by Jenkins b07a86d is described below commit b07a86dc755212ca6527cfbf9fc71e313822d377 Author: jenkins <bui...@apache.org> AuthorDate: Sun Dec 10 08:15:43 2017 +0000 Updates production by Jenkins --- ...essing-application-session-request-objects.html | 173 +-------------------- content/core-developers/action-chaining.html | 4 +- content/core-developers/action-configuration.html | 4 +- content/core-developers/action-event-listener.html | 4 +- content/core-developers/action-mapper.html | 102 +++++------- .../action-proxy-and-actionproxy-factory.html | 15 +- content/core-developers/after-annotation.html | 40 ++--- content/core-developers/annotations.html | 43 ++--- content/core-developers/before-annotation.html | 39 ++--- .../core-developers/before-result-annotation.html | 39 ++--- content/core-developers/conversion-annotation.html | 14 +- ...onversion-error-field-validator-annotation.html | 4 +- .../core-developers/create-if-null-annotation.html | 11 +- .../custom-validator-annotation.html | 11 +- .../date-range-field-validator-annotation.html | 16 +- .../double-range-field-validator-annotation.html | 20 +-- content/core-developers/element-annotation.html | 22 ++- .../email-validator-annotation.html | 12 +- .../expression-validator-annotation.html | 11 +- .../field-expression-validator-annotation.html | 14 +- .../core-developers/input-config-annotation.html | 37 ++--- .../int-range-field-validator-annotation.html | 20 +-- content/core-developers/key-annotation.html | 12 +- .../core-developers/key-property-annotation.html | 15 +- .../regex-field-validator-annotation.html | 11 +- .../required-field-validator-annotation.html | 11 +- .../required-string-validator-annotation.html | 11 +- content/core-developers/restful-action-mapper.html | 170 ++++++++++---------- .../string-length-field-validator-annotation.html | 19 +-- .../type-conversion-annotation.html | 37 ++--- .../core-developers/url-validator-annotation.html | 73 ++++----- content/core-developers/validation-annotation.html | 72 +++------ .../core-developers/validations-annotation.html | 95 +++++------ .../visitor-field-validator-annotation.html | 24 ++- 34 files changed, 442 insertions(+), 763 deletions(-) diff --git a/content/core-developers/accessing-application-session-request-objects.html b/content/core-developers/accessing-application-session-request-objects.html index 19db389..9a25f50 100644 --- a/content/core-developers/accessing-application-session-request-objects.html +++ b/content/core-developers/accessing-application-session-request-objects.html @@ -1,133 +1,4 @@ -<!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>Accessing application, session, request objects</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"> - <link href="/highlighter/github-theme.css" rel="stylesheet"> - - <script src="//code.jquery.com/jquery-1.11.0.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="/download.cgi">Download</a></li> - <li><a href="/releases.html">Releases</a></li> - <li><a href="/announce.html">Announcements</a></li> - <li><a href="http://www.apache.org/licenses/">License</a></li> - <li><a href="https://www.apache.org/foundation/thanks.html">Thanks!</a></li> - <li><a href="https://www.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="https://cwiki.apache.org/confluence/display/WW/Migration+Guide">Version Notes</a></li> - <li><a href="https://cwiki.apache.org/confluence/display/WW/Security+Bulletins">Security Bulletins</a></li> - <li class="divider"></li> - <li><a href="/maven/project-info.html">Maven 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="/getting-started/">Getting Started</a></li> - <li><a href="/security/">Security Guide</a></li> - <li><a href="/core-developers/">Core Developers Guide</a></li> - <li><a href="/tag-developers/">Tag Developers Guide</a></li> - <li><a href="/maven-archetypes/">Maven Archetypes</a></li> - <li><a href="/plugins/">Plugins</a></li> - <li><a href="/maven/struts2-core/apidocs/index.html">Struts Core API</a></li> - <li><a href="/tag-developers/tag-reference.html">Tag reference</a></li> - <li><a href="https://cwiki.apache.org/confluence/display/WW/FAQs">FAQs</a></li> - <li><a href="http://cwiki.apache.org/S2PLUGINS/home.html">Plugin registry</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 and Builds</a></li> - <li><a href="/coding-standards.html">Coding standards</a></li> - <li><a href="https://cwiki.apache.org/confluence/display/WW/Contributors+Guide">Contributors Guide</a></li> - <li class="divider"></li> - <li><a href="/release-guidelines.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"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> - <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/accessing-application-session-request-objects.md" title="Edit this page on GitHub">Edit on GitHub</a> - <h1 id="accessing-application-session-request-objects">Accessing application, session, request objects</h1> +<h1 id="accessing-application-session-request-objects">Accessing application, session, request objects</h1> <p><strong>DEPRECATED???</strong></p> @@ -185,45 +56,3 @@ doean’t exist, it will search the request, session, and application scopes, in <s:property value="#attr.myId" /> </code></pre> - - </section> -</article> - - -<footer class="container"> - <div class="col-md-12"> - Copyright © 2000-2017 <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> - - -</body> -</html> diff --git a/content/core-developers/action-chaining.html b/content/core-developers/action-chaining.html index baeca6e..5a17f7d 100644 --- a/content/core-developers/action-chaining.html +++ b/content/core-developers/action-chaining.html @@ -125,8 +125,10 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/action-chaining.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> + <h1 id="action-chaining">Action Chaining</h1> <p>The framework provides the ability to chain multiple actions into a defined sequence or workflow. This feature works diff --git a/content/core-developers/action-configuration.html b/content/core-developers/action-configuration.html index bce34af..716ed77 100644 --- a/content/core-developers/action-configuration.html +++ b/content/core-developers/action-configuration.html @@ -125,8 +125,10 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/action-configuration.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> + <h1 class="no_toc" id="action-configuration">Action Configuration</h1> <ul id="markdown-toc"> diff --git a/content/core-developers/action-event-listener.html b/content/core-developers/action-event-listener.html index 90d9d21..c4dbbe3 100644 --- a/content/core-developers/action-event-listener.html +++ b/content/core-developers/action-event-listener.html @@ -125,8 +125,10 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/action-event-listener.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> + <h1 id="actioneventlistener">ActionEventListener</h1> <p>An <code class="highlighter-rouge">ActionEventListener</code> can be used to add some logic when action’s instance is created or when exception occurred diff --git a/content/core-developers/action-mapper.html b/content/core-developers/action-mapper.html index 6ae028d..d19881a 100644 --- a/content/core-developers/action-mapper.html +++ b/content/core-developers/action-mapper.html @@ -125,8 +125,10 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/action-mapper.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> + <h1 class="no_toc" id="actionmapper">ActionMapper</h1> <ul id="markdown-toc"> @@ -140,7 +142,10 @@ </li> <li><a href="#custom-actionmapper" id="markdown-toc-custom-actionmapper">Custom ActionMapper</a></li> <li><a href="#compositeactionmapper" id="markdown-toc-compositeactionmapper">CompositeActionMapper</a></li> - <li><a href="#prefixbasedactionmapper" id="markdown-toc-prefixbasedactionmapper">PrefixBasedActionMapper</a></li> + <li><a href="#prefixbasedactionmapper" id="markdown-toc-prefixbasedactionmapper">PrefixBasedActionMapper</a> <ul> + <li><a href="#prefixbasedactionproxyfactory" id="markdown-toc-prefixbasedactionproxyfactory">PrefixBasedActionProxyFactory</a></li> + </ul> + </li> <li><a href="#actionmapper-and-actionmapping-objects" id="markdown-toc-actionmapper-and-actionmapping-objects">ActionMapper and ActionMapping objects</a></li> <li><a href="#customize" id="markdown-toc-customize">Customize</a></li> </ul> @@ -271,70 +276,47 @@ and “restful” which is <code class="highlighter-rouge">org.apache.struts2.di <h2 id="prefixbasedactionmapper">PrefixBasedActionMapper</h2> -<p> <p> - - A prefix based action mapper that is capable of delegating to other {@link ActionMapper}s based on the request's prefix.<br /> - - It is configured through struts.xml<br /> - - For example, with the following entries in struts.properties - - </p> - - - - <pre> - - <constant name="struts.mapper.class" value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper" /> - - <constant name="struts.mapper.prefixMapping" value="/communities:pseudoRestful,/communityTags:pseudoRestful,/events:pseudoRestful,/mediaList:pseudoRestful,/users:pseudoRestful,/community:struts,/communityTag:struts,/event:struts,/media:struts,/user:struts,:struts" /> - - </pre> - - - - <p> - - When {@link PrefixBasedActionMapper#getMapping(HttpServletRequest, ConfigurationManager)} or - - {@link PrefixBasedActionMapper#getUriFromActionMapping(ActionMapping)} is invoked, - - {@link PrefixBasedActionMapper} will check each possible prefix (url prefix terminating just before a /) to find the most specific ActionMapper that returns a mapping when asked to map the request. If none are found, null is returned for both - - {@link PrefixBasedActionMapper#getMapping(HttpServletRequest, ConfigurationManager)} and - - {@link PrefixBasedActionMapper#getUriFromActionMapping(ActionMapping)} methods. - - </p> - - - -</p> +<p>A prefix based action mapper that is capable of delegating to other <code class="highlighter-rouge">ActionMapper</code>s based on the request’s prefix. +It is configured through <code class="highlighter-rouge">struts.xml</code>. For example, with the following entries in <code class="highlighter-rouge">struts.xml</code>:</p> + +<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt"><constant</span> <span class="na">name=</span><span class="s">"struts.mapper.class"</span> <span class="na">value=</span><span class="s">"org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper"</span><span class="nt">/></span> + +<span class="nt"><constant</span> <span class="na">name=</span><span class="s">"struts.mapper.prefixMapping"</span> <span class="na">value=</span><span class="s">"</span> + <span class="err">/communities:pseudoRestful,</span> + <span class="err">/communityTags:pseudoRestful,</span> + <span class="err">/events:pseudoRestful,</span> + <span class="err">/mediaList:pseudoRestful,</span> + <span class="err">/users:pseudoRestful,</span> + <span class="err">/community:struts,</span> + <span class="err">/communityTag:struts,</span> + <span class="err">/event:struts,</span> + <span class="err">/media:struts,</span> + <span class="err">/user:struts,:struts</span> +<span class="err">"</span><span class="nt">/></span> +</code></pre> +</div> +<p>When <code class="highlighter-rouge">PrefixBasedActionMapper#getMapping(HttpServletRequest, ConfigurationManager)</code> or <code class="highlighter-rouge">PrefixBasedActionMapper#getUriFromActionMapping(ActionMapping)</code> +is invoked, <code class="highlighter-rouge">PrefixBasedActionMapper</code> will check each possible prefix (url prefix terminating just before a <code class="highlighter-rouge">/</code>) to find +the most specific <code class="highlighter-rouge">ActionMapper</code> that returns a mapping when asked to map the request. If none are found, null is returned +for both <code class="highlighter-rouge">PrefixBasedActionMapper#getMapping(HttpServletRequest, ConfigurationManager)</code> and +<code class="highlighter-rouge">PrefixBasedActionMapper#getUriFromActionMapping(ActionMapping)</code> methods.</p> -<p><strong>PrefixBasedActionProxyFactory</strong></p> +<h3 id="prefixbasedactionproxyfactory">PrefixBasedActionProxyFactory</h3> -<p> <p> - Prefix based factory should be used with {@link org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper} - to use appropriate {@link com.opensymphony.xwork2.ActionProxyFactory} connected with given - {@link org.apache.struts2.dispatcher.mapper.ActionMapper} - </p> +<p>Prefix based factory should be used with <code class="highlighter-rouge">org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper</code> to use +appropriate <code class="highlighter-rouge">com.opensymphony.xwork2.ActionProxyFactory</code> connected with given <code class="highlighter-rouge">org.apache.struts2.dispatcher.mapper.ActionMapper</code>.</p> - <p> - Add below entry to struts.xml to enable the factory: - </p> +<p>Add below entry to <code class="highlighter-rouge">struts.xml</code> to enable the factory:</p> - <pre> - <constant name="struts.actionProxyFactory" value="prefix" /> - </pre> +<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt"><constant</span> <span class="na">name=</span><span class="s">"struts.actionProxyFactory"</span> <span class="na">value=</span><span class="s">"prefix"</span><span class="nt">/></span> +</code></pre> +</div> - <p> - The factory will use the same set of patterns as defined with: - </p> +<p>The factory will use the same set of patterns as defined with:</p> - <pre> - <constant name="struts.mapper.prefixMapping" value="..." /> - </pre> -</p> +<div class="highlighter-rouge"><pre class="highlight"><code> <span class="nt"><constant</span> <span class="na">name=</span><span class="s">"struts.mapper.prefixMapping"</span> <span class="na">value=</span><span class="s">"..."</span><span class="nt">/></span> +</code></pre> +</div> <h2 id="actionmapper-and-actionmapping-objects">ActionMapper and ActionMapping objects</h2> diff --git a/content/core-developers/action-proxy-and-actionproxy-factory.html b/content/core-developers/action-proxy-and-actionproxy-factory.html index cc58df9..36a361a 100644 --- a/content/core-developers/action-proxy-and-actionproxy-factory.html +++ b/content/core-developers/action-proxy-and-actionproxy-factory.html @@ -125,9 +125,20 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/action-proxy-and-actionproxy-factory.md" title="Edit this page on GitHub">Edit on GitHub</a> - <h1 id="action-proxy--actionproxy-factory">Action Proxy & ActionProxy Factory</h1> + + <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> + + <h1 class="no_toc" id="action-proxy--actionproxy-factory">Action Proxy & ActionProxy Factory</h1> + +<ul id="markdown-toc"> + <li><a href="#customization" id="markdown-toc-customization">Customization</a> <ul> + <li><a href="#actionproxyfactory" id="markdown-toc-actionproxyfactory">ActionProxyFactory</a></li> + <li><a href="#actionproxy" id="markdown-toc-actionproxy">ActionProxy</a></li> + <li><a href="#actioninvocation" id="markdown-toc-actioninvocation">ActionInvocation</a></li> + </ul> + </li> +</ul> <p>The ActionProxy obtains the Action class and calls the appropriate method. By default, Actions are obtained through local instantiation, but an Action could also be obtained remotely if an alternative ActionProxy were provided.</p> diff --git a/content/core-developers/after-annotation.html b/content/core-developers/after-annotation.html index e31f7db..48ca6b1 100644 --- a/content/core-developers/after-annotation.html +++ b/content/core-developers/after-annotation.html @@ -125,41 +125,25 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/after-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="after-annotation">After Annotation</h1> -<h2 id="after-annotation-1">After Annotation</h2> +<p>Marks an action method that needs to be called after the main action method and the result was executed. Return value is ignored.</p> -<p> Marks a action method that needs to be called after the main action method and the result was - executed. Return value is ignored. -</p> +<h2 id="usage">Usage</h2> -<h3 id="usage">Usage</h3> +<p>The <code class="highlighter-rouge">After</code> annotation can be applied at method level.</p> -<p> The After annotation can be applied at method level. +<h2 id="parameters">Parameters</h2> -</p> +<ul> + <li><code class="highlighter-rouge">priority</code> (optional) - Priority order of method execution, default: <em>10</em></li> +</ul> -<h3 id="parameters">Parameters</h3> - -<p> <table class="confluenceTable" summary=""> - <tr> - <th class="confluenceTh"> Parameter </th> - <th class="confluenceTh"> Required </th> - <th class="confluenceTh"> Default </th> - <th class="confluenceTh"> Notes </th> - </tr> - <tr> - <td class="confluenceTd">priority</td> - <td class="confluenceTd">no</td> - <td class="confluenceTd">10</td> - <td class="confluenceTd">Priority order of method execution</td> - </tr> - </table> -</p> - -<h3 id="examples">Examples</h3> +<h2 id="examples">Examples</h2> <div class="highlighter-rouge"><pre class="highlight"><code> <span class="kd">public</span> <span class="kd">class</span> <span class="nc">SampleAction</span> <span class="kd">extends</span> <span class="n">ActionSupport</span> <span class="o">{</span> @@ -173,11 +157,9 @@ <span class="k">return</span> <span class="n">SUCCESS</span><span class="o">;</span> <span class="o">}</span> <span class="o">}</span> - </code></pre> </div> - </section> </article> diff --git a/content/core-developers/annotations.html b/content/core-developers/annotations.html index df47e88..4240736 100644 --- a/content/core-developers/annotations.html +++ b/content/core-developers/annotations.html @@ -125,8 +125,10 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/annotations.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> + <h1 class="no_toc" id="annotations">Annotations</h1> <ul id="markdown-toc"> @@ -146,12 +148,12 @@ This page serves as a reference for all annotations across the framework.</p> <h2 id="action-annotations">Action Annotations</h2> -<p>Since 2.1, these annotations are provided by the <em>Convention Plugin</em>. Codebehind and Zero Config plugins are -deprecated from 2.1 on.</p> +<p>Since Struts 2.1, these annotations are provided by the <a href="../plugins/convention/">Convention Plugin</a>. Codebehind and Zero Config +plugins are deprecated from Struts 2.1 on.</p> <p>Action annotations are available when the framework scans the classpath for Action classes, rather than specifying -individual mappings through XML configuration. See the <em>Convention Plugin</em> page for information on how to set up -classpath scanning to allow the use of Action annotations.</p> +individual mappings through XML configuration. See the <a href="../plugins/convention/">Convention Plugin</a> page for information +on how to set up classpath scanning to allow the use of Action annotations.</p> <table> <thead> @@ -162,27 +164,27 @@ classpath scanning to allow the use of Action annotations.</p> </thead> <tbody> <tr> - <td><em>Actions Annotation</em></td> + <td><a href="../plugins/convention/#action-annotation">Actions Annotation</a></td> <td>Group of <code class="highlighter-rouge">@Action</code> annotations, maps multiple URLs to the same action</td> </tr> <tr> - <td><em>Action Annotation</em></td> + <td><a href="../plugins/convention/#action-annotation">Action Annotation</a></td> <td>Defines the URL of an action</td> </tr> <tr> - <td><em>InterceptorRefs Annotation</em></td> - <td>Gropup of <code class="highlighter-rouge">@InterceptorRef</code> annotations</td> + <td><a href="../plugins/convention/#interceptorref-annotation">InterceptorRefs Annotation</a></td> + <td>Group of <code class="highlighter-rouge">@InterceptorRef</code> annotations</td> </tr> <tr> - <td><em>InterceptorRef Annotation</em></td> + <td><a href="../plugins/convention/#interceptorref-annotation">InterceptorRef Annotation</a></td> <td>Interceptor, or interceptor stack to be applied to at action</td> </tr> <tr> - <td><em>Results Annotation</em></td> + <td><a href="../plugins/convention/#result-annotation">Results Annotation</a></td> <td>Group of <code class="highlighter-rouge">@Result</code> annotations</td> </tr> <tr> - <td><a href="result-annotation.html">Result Annotation</a></td> + <td><a href="../plugins/convention/#result-annotation">Result Annotation</a></td> <td>Defines a result for an action</td> </tr> <tr> @@ -190,19 +192,19 @@ classpath scanning to allow the use of Action annotations.</p> <td>Set the path of the action URL (used to overwrite the default)</td> </tr> <tr> - <td><em>ResultPath Annotation</em></td> + <td><a href="../plugins/convention/#resultpath-annotation">ResultPath Annotation</a></td> <td>Set where the results are located (used to overwrite the default)</td> </tr> <tr> - <td><a href="parent-package-annotation.html">ParentPackage Annotation</a></td> + <td><a href="..//plugins/convention/#parentpackage-annotation">ParentPackage Annotation</a></td> <td>Set the parent package of the actions (used to overwrite the default)</td> </tr> <tr> - <td><em>ExceptionMappings</em></td> + <td><a href="../plugins/convention/#exceptionmapping-annotation">ExceptionMappings</a></td> <td>Group of <code class="highlighter-rouge">@ExceptionMapping</code> annotations</td> </tr> <tr> - <td><em>ExceptionMapping</em></td> + <td><a href="../plugins/convention/#exceptionmapping-annotation">ExceptionMapping</a></td> <td>Defines an exception mapping</td> </tr> </tbody> @@ -227,7 +229,8 @@ classpath scanning to allow the use of Action annotations.</p> <h2 id="interceptor-annotations">Interceptor Annotations</h2> -<p>To use these annotations, you have to specify the <a href="annotation-workflow-interceptor.html">AnnotationWorkflowInterceptor</a> to your interceptor stack.</p> +<p>To use these annotations, you have to specify the <a href="annotation-workflow-interceptor.html">AnnotationWorkflowInterceptor</a> +to your interceptor stack.</p> <table> <thead> @@ -334,7 +337,7 @@ classpath scanning to allow the use of Action annotations.</p> <h3 id="resources">Resources</h3> <ul> - <li><a href="http://arsenalist.com/2007/05/10/struts-2-validation-using-annotations/">Validation using Annotations</a>^[http://arsenalist.com/2007/05/10/struts-2-validation-using-annotations/] (arsenalist)</li> + <li><a href="http://arsenalist.com/2007/05/10/struts-2-validation-using-annotations/">Validation using Annotations</a> (arsenalist)</li> </ul> <h2 id="type-conversion-annotations">Type Conversion Annotations</h2> @@ -384,8 +387,8 @@ an application should be able to avoid using any <code class="highlighter-rouge" <h2 id="tiles-annotations">Tiles Annotations</h2> -<p>The <em>Tiles Plugin</em> provides it’s own set of Annotations. They can be used to keep <code class="highlighter-rouge">tiles.xml</code> short. Instead tiles -definitions can be created by annotating actions.</p> +<p>The <a href="../plugins/tiles/">Tiles Plugin</a> provides it’s own set of Annotations. They can be used to keep <code class="highlighter-rouge">tiles.xml</code> short. +Instead tiles definitions can be created by annotating actions.</p> <table> <thead> diff --git a/content/core-developers/before-annotation.html b/content/core-developers/before-annotation.html index 7183a48..e2cee8e 100644 --- a/content/core-developers/before-annotation.html +++ b/content/core-developers/before-annotation.html @@ -125,40 +125,25 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/before-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="before-annotation">Before Annotation</h1> -<h2 id="before-annotation-1">Before Annotation</h2> +<p>Marks an action method that needs to be executed before the main action method.</p> -<p> Marks a action method that needs to be executed before the main action method. -</p> +<h2 id="usage">Usage</h2> -<h3 id="usage">Usage</h3> +<p>The <code class="highlighter-rouge">Before</code> annotation can be applied at method level.</p> -<p> The Before annotation can be applied at method level. +<h2 id="parameters">Parameters</h2> -</p> +<ul> + <li><code class="highlighter-rouge">priority</code> (optional) - Priority order of method execution, default: <em>10</em></li> +</ul> -<h3 id="parameters">Parameters</h3> - -<p> <table class="confluenceTable" summary=""> - <tr> - <th class="confluenceTh"> Parameter </th> - <th class="confluenceTh"> Required </th> - <th class="confluenceTh"> Default </th> - <th class="confluenceTh"> Notes </th> - </tr> - <tr> - <td class="confluenceTd">priority</td> - <td class="confluenceTd">no</td> - <td class="confluenceTd">10</td> - <td class="confluenceTd">Priority order of method execution</td> - </tr> - </table> -</p> - -<h3 id="examples">Examples</h3> +<h2 id="examples">Examples</h2> <div class="highlighter-rouge"><pre class="highlight"><code> <span class="kd">public</span> <span class="kd">class</span> <span class="nc">SampleAction</span> <span class="kd">extends</span> <span class="n">ActionSupport</span> <span class="o">{</span> @@ -172,11 +157,9 @@ <span class="k">return</span> <span class="n">SUCCESS</span><span class="o">;</span> <span class="o">}</span> <span class="o">}</span> - </code></pre> </div> - </section> </article> diff --git a/content/core-developers/before-result-annotation.html b/content/core-developers/before-result-annotation.html index 7a9aafb..44ca160 100644 --- a/content/core-developers/before-result-annotation.html +++ b/content/core-developers/before-result-annotation.html @@ -125,40 +125,25 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/before-result-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="beforeresult-annotation">BeforeResult Annotation</h1> -<h2 id="beforeresult-annotation-1">BeforeResult Annotation</h2> +<p>Marks an action method that needs to be executed before the result. Return value is ignored.</p> -<p> Marks a action method that needs to be executed before the result. Return value is ignored. -</p> +<h2 id="usage">Usage</h2> -<h3 id="usage">Usage</h3> +<p>The <code class="highlighter-rouge">BeforeResult</code> annotation can be applied at method level.</p> -<p> The BeforeResult annotation can be applied at method level. +<h2 id="parameters">Parameters</h2> -</p> +<ul> + <li><code class="highlighter-rouge">priority</code> (optional) - Priority order of method execution, default: <em>10</em></li> +</ul> -<h3 id="parameters">Parameters</h3> - -<p> <table class="confluenceTable" summary=""> - <tr> - <th class="confluenceTh"> Parameter </th> - <th class="confluenceTh"> Required </th> - <th class="confluenceTh"> Default </th> - <th class="confluenceTh"> Notes </th> - </tr> - <tr> - <td class="confluenceTd">priority</td> - <td class="confluenceTd">no</td> - <td class="confluenceTd">10</td> - <td class="confluenceTd">Priority order of method execution</td> - </tr> - </table> -</p> - -<h3 id="examples">Examples</h3> +<h2 id="examples">Examples</h2> <div class="highlighter-rouge"><pre class="highlight"><code> <span class="kd">public</span> <span class="kd">class</span> <span class="nc">SampleAction</span> <span class="kd">extends</span> <span class="n">ActionSupport</span> <span class="o">{</span> @@ -172,11 +157,9 @@ <span class="k">return</span> <span class="n">SUCCESS</span><span class="o">;</span> <span class="o">}</span> <span class="o">}</span> - </code></pre> </div> - </section> </article> diff --git a/content/core-developers/conversion-annotation.html b/content/core-developers/conversion-annotation.html index 781ede9..c19f983 100644 --- a/content/core-developers/conversion-annotation.html +++ b/content/core-developers/conversion-annotation.html @@ -125,17 +125,17 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/conversion-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="conversion-annotation">Conversion Annotation</h1> -<p> A marker annotation for type conversions at Type level. -</p> +<p>A marker annotation for type conversions at Type level.</p> <h2 id="usage">Usage</h2> -<p> The Conversion annotation must be applied at Type level. -</p> +<p>The <code class="highlighter-rouge">Conversion</code> annotation must be applied at Type level.</p> <h2 id="parameters">Parameters</h2> @@ -150,7 +150,7 @@ </thead> <tbody> <tr> - <td>conversion</td> + <td>conversions</td> <td>no</td> <td> </td> <td>used for Type Conversions applied at Type level.</td> @@ -180,8 +180,6 @@ <span class="o">}</span> <span class="o">}</span> - - </code></pre> </div> diff --git a/content/core-developers/conversion-error-field-validator-annotation.html b/content/core-developers/conversion-error-field-validator-annotation.html index 87c59a7..5576c13 100644 --- a/content/core-developers/conversion-error-field-validator-annotation.html +++ b/content/core-developers/conversion-error-field-validator-annotation.html @@ -125,8 +125,10 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/conversion-error-field-validator-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="conversionerrorfieldvalidator-annotation">ConversionErrorFieldValidator Annotation</h1> <p>This validator checks if there are any conversion errors for a field and applies them if they exist. diff --git a/content/core-developers/create-if-null-annotation.html b/content/core-developers/create-if-null-annotation.html index 4b4a588..404e640 100644 --- a/content/core-developers/create-if-null-annotation.html +++ b/content/core-developers/create-if-null-annotation.html @@ -125,17 +125,17 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/create-if-null-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="createifnull-annotation">CreateIfNull Annotation</h1> -<p> <p>Sets the CreateIfNull for type conversion.</p> -</p> +<p>Sets the <code class="highlighter-rouge">CreateIfNull</code> for type conversion.</p> <h2 id="usage">Usage</h2> -<p> <p>The CreateIfNull annotation must be applied at field or method level.</p> -</p> +<p>The <code class="highlighter-rouge">CreateIfNull</code> annotation must be applied at field or method level.</p> <h2 id="parameters">Parameters</h2> @@ -167,7 +167,6 @@ </code></pre> </div> - </section> </article> diff --git a/content/core-developers/custom-validator-annotation.html b/content/core-developers/custom-validator-annotation.html index 3bb0c4b..77ada16 100644 --- a/content/core-developers/custom-validator-annotation.html +++ b/content/core-developers/custom-validator-annotation.html @@ -125,17 +125,17 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/custom-validator-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="customvalidator-annotation">CustomValidator Annotation</h1> -<p> This annotation can be used for custom validators. Use the ValidationParameter annotation to supply additional params. -</p> +<p>This annotation can be used for custom validators. Use the <code class="highlighter-rouge">ValidationParameter</code> annotation to supply additional params.</p> <h2 id="usage">Usage</h2> -<p> <p>The annotation must be applied at method or type level.</p> -</p> +<p>The annotation must be applied at method or type level.</p> <h2 id="parameters">Parameters</h2> @@ -188,7 +188,6 @@ <h2 id="examples">Examples</h2> <div class="highlighter-rouge"><pre class="highlight"><code> <span class="nd">@CustomValidator</span><span class="o">(</span><span class="n">type</span> <span class="o">=</span><span class="s">"customValidatorName"</span><span class="o">,</span> <span class="n">fieldName</span> <span class="o">=</span> <span class="s">"myField"</span><span class="o">)</span> - </code></pre> </div> diff --git a/content/core-developers/date-range-field-validator-annotation.html b/content/core-developers/date-range-field-validator-annotation.html index 521af3b..fa2cca1 100644 --- a/content/core-developers/date-range-field-validator-annotation.html +++ b/content/core-developers/date-range-field-validator-annotation.html @@ -125,17 +125,17 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/date-range-field-validator-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="daterangefieldvalidator-annotation">DateRangeFieldValidator Annotation</h1> -<p> This validator checks that a date field has a value within a specified range. -</p> +<p>This validator checks that a date field has a value within a specified range.</p> <h2 id="usage">Usage</h2> -<p> <p>The annotation must be applied at method level.</p> -</p> +<p>The annotation must be applied at method level.</p> <h2 id="parameters">Parameters</h2> @@ -219,18 +219,16 @@ <td class="confluenceTd">Format used to parse min/max value.</td> </tr> </table> - - <p>If neither <em>min</em> nor <em>max</em> is set, nothing will be done.</p> </p> +<p>If neither <code class="highlighter-rouge">min</code> nor <code class="highlighter-rouge">max</code> is set, nothing will be done.</p> + <h2 id="examples">Examples</h2> <div class="highlighter-rouge"><pre class="highlight"><code> <span class="nd">@DateRangeFieldValidator</span><span class="o">(</span><span class="n">message</span> <span class="o">=</span> <span class="s">"Default message"</span><span class="o">,</span> <span class="n">key</span> <span class="o">=</span> <span class="s">"i18n.key"</span><span class="o">,</span> <span class="n">shortCircuit</span> <span class="o">=</span> <span class="kc">true</span><span class="o">,</span> <span class="n [...] - </code></pre> </div> - </section> </article> diff --git a/content/core-developers/double-range-field-validator-annotation.html b/content/core-developers/double-range-field-validator-annotation.html index 3c98d89..c459ce8 100644 --- a/content/core-developers/double-range-field-validator-annotation.html +++ b/content/core-developers/double-range-field-validator-annotation.html @@ -125,18 +125,17 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/double-range-field-validator-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="doublerangefieldvalidator-annotation">DoubleRangeFieldValidator Annotation</h1> -<p> This validator checks that a double field has a value within a specified range. - If neither min nor max is set, nothing will be done. -</p> +<p>This validator checks that a double field has a value within a specified range. If neither <code class="highlighter-rouge">min</code> nor <code class="highlighter-rouge">max</code> is set, nothing will be done.</p> <h2 id="usage">Usage</h2> -<p> <p>The annotation must be applied at method level.</p> -</p> +<p>The annotation must be applied at method level.</p> <h2 id="parameters">Parameters</h2> @@ -231,21 +230,18 @@ <td class="confluenceTd"> </td> <td class="confluenceTd">OGNL expression used to obtain the exclusive maximum number can be. </td> </tr> - </table> + </table> </p> - <p>If neither <em>min</em> nor <em>max</em> is set, nothing will be done.</p> +<p>If neither <code class="highlighter-rouge">min</code> nor <code class="highlighter-rouge">max</code> is set, nothing will be done.</p> - <p>The values for min and max must be inserted as String values so that "0" can be handled as a possible value.</p> -</p> +<p>The values for <code class="highlighter-rouge">min</code> and <code class="highlighter-rouge">max</code> must be inserted as String values so that <code class="highlighter-rouge">"0"</code> can be handled as a possible value.</p> <h2 id="examples">Examples</h2> <div class="highlighter-rouge"><pre class="highlight"><code> <span class="nd">@DoubleRangeFieldValidator</span><span class="o">(</span><span class="n">message</span> <span class="o">=</span> <span class="s">"Default message"</span><span class="o">,</span> <span class="n">key</span> <span class="o">=</span> <span class="s">"i18n.key"</span><span class="o">,</span> <span class="n">shortCircuit</span> <span class="o">=</span> <span class="kc">true</span><span class="o">,</span> <span class= [...] - </code></pre> </div> - </section> </article> diff --git a/content/core-developers/element-annotation.html b/content/core-developers/element-annotation.html index ba53b2d..2dd0a24 100644 --- a/content/core-developers/element-annotation.html +++ b/content/core-developers/element-annotation.html @@ -125,17 +125,17 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/element-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="element-annotation">Element Annotation</h1> -<p> <p>Sets the Element for type conversion.</p> -</p> +<p>Sets the <code class="highlighter-rouge">Element</code> for type conversion.</p> <h2 id="usage">Usage</h2> -<p> <p>The Element annotation must be applied at field or method level.</p> -</p> +<p>The <code class="highlighter-rouge">Element</code> annotation must be applied at field or method level.</p> <h2 id="parameters">Parameters</h2> @@ -161,14 +161,12 @@ <h2 id="examples">Examples</h2> -<div class="highlighter-rouge"><pre class="highlight"><code> -// The key property for User objects within the users collection is the <code>userName</code> attribute. -@Element( value = com.acme.User.class ) -private Map userMap; - -@Element( value = com.acme.User.class ) -public List userList; +<div class="highlighter-rouge"><pre class="highlight"><code><span class="c1">// The key property for User objects within the users collection is the <code>userName</code> attribute.</span> +<span class="nd">@Element</span><span class="o">(</span> <span class="n">value</span> <span class="o">=</span> <span class="n">com</span><span class="o">.</span><span class="na">acme</span><span class="o">.</span><span class="na">User</span><span class="o">.</span><span class="na">class</span> <span class="o">)</span> +<span class="kd">private</span> <span class="n">Map</span> <span class="n">userMap</span><span class="o">;</span> +<span class="nd">@Element</span><span class="o">(</span> <span class="n">value</span> <span class="o">=</span> <span class="n">com</span><span class="o">.</span><span class="na">acme</span><span class="o">.</span><span class="na">User</span><span class="o">.</span><span class="na">class</span> <span class="o">)</span> +<span class="kd">public</span> <span class="n">List</span> <span class="n">userList</span><span class="o">;</span> </code></pre> </div> diff --git a/content/core-developers/email-validator-annotation.html b/content/core-developers/email-validator-annotation.html index 72aa0ea..95ecaca 100644 --- a/content/core-developers/email-validator-annotation.html +++ b/content/core-developers/email-validator-annotation.html @@ -125,17 +125,17 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/email-validator-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="emailvalidator-annotation">EmailValidator Annotation</h1> -<p> This validator checks that a field is a valid e-mail address if it contains a non-empty String. -</p> +<p>This validator checks that a field is a valid e-mail address if it contains a non-empty String.</p> <h2 id="usage">Usage</h2> -<p> <p>The annotation must be applied at method level.</p> -</p> +<p>The annotation must be applied at method level.</p> <h2 id="parameters">Parameters</h2> @@ -188,11 +188,9 @@ <h2 id="examples">Examples</h2> <div class="highlighter-rouge"><pre class="highlight"><code> <span class="nd">@EmailValidator</span><span class="o">(</span><span class="n">message</span> <span class="o">=</span> <span class="s">"Default message"</span><span class="o">,</span> <span class="n">key</span> <span class="o">=</span> <span class="s">"i18n.key"</span><span class="o">,</span> <span class="n">shortCircuit</span> <span class="o">=</span> <span class="kc">true</span><span class="o">)</span> - </code></pre> </div> - </section> </article> diff --git a/content/core-developers/expression-validator-annotation.html b/content/core-developers/expression-validator-annotation.html index 393b8a3..fa078e2 100644 --- a/content/core-developers/expression-validator-annotation.html +++ b/content/core-developers/expression-validator-annotation.html @@ -125,17 +125,17 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/expression-validator-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="expressionvalidator-annotation">ExpressionValidator Annotation</h1> -<p> This non-field level validator validates a supplied regular expression. -</p> +<p>This non-field level validator validates a supplied regular expression.</p> <h2 id="usage">Usage</h2> -<p> <p>The annotation must be applied at method level.</p> -</p> +<p>The annotation must be applied at method level.</p> <h2 id="parameters">Parameters</h2> @@ -186,7 +186,6 @@ </code></pre> </div> - </section> </article> diff --git a/content/core-developers/field-expression-validator-annotation.html b/content/core-developers/field-expression-validator-annotation.html index da5588a..91b2360 100644 --- a/content/core-developers/field-expression-validator-annotation.html +++ b/content/core-developers/field-expression-validator-annotation.html @@ -125,19 +125,18 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/field-expression-validator-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="fieldexpressionvalidator-annotation">FieldExpressionValidator Annotation</h1> -<p> This validator uses an OGNL expression to perform its validator. - The error message will be added to the field if the expression returns - false when it is evaluated against the value stack. -</p> +<p>This validator uses an OGNL expression to perform its validator. The error message will be added to the field if the expression +returns false when it is evaluated against the value stack.</p> <h2 id="usage">Usage</h2> -<p> <p>The annotation must be applied at method level.</p> -</p> +<p>The annotation must be applied at method level.</p> <h2 id="parameters">Parameters</h2> @@ -194,7 +193,6 @@ </code></pre> </div> - </section> </article> diff --git a/content/core-developers/input-config-annotation.html b/content/core-developers/input-config-annotation.html index f0aa41d..f5f43eb 100644 --- a/content/core-developers/input-config-annotation.html +++ b/content/core-developers/input-config-annotation.html @@ -125,42 +125,24 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/input-config-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="inputconfig-annotation">InputConfig Annotation</h1> -<p> Marks a action method that if it's not validated by ValidationInterceptor then execute input method or input result. -</p> +<p>Marks an action method that if it’s not validated by <code class="highlighter-rouge">ValidationInterceptor</code> then execute <code class="highlighter-rouge">input</code> method or <code class="highlighter-rouge">input</code> result.</p> <h2 id="usage">Usage</h2> -<p> The InputConfig annotation can be applied at method level. - -</p> +<p>The <code class="highlighter-rouge">InputConfig</code> annotation can be applied at method level.</p> <h2 id="parameters">Parameters</h2> -<p> <table class="confluenceTable" summary=""> - <tr> - <th class="confluenceTh"> Parameter </th> - <th class="confluenceTh"> Required </th> - <th class="confluenceTh"> Default </th> - <th class="confluenceTh"> Notes </th> - </tr> - <tr> - <td class="confluenceTd">methodName</td> - <td class="confluenceTd">no</td> - <td class="confluenceTd"></td> - <td class="confluenceTd">execute this method if specific</td> - </tr> - <tr> - <td class="confluenceTd">resultName</td> - <td class="confluenceTd">no</td> - <td class="confluenceTd"></td> - <td class="confluenceTd">return this result if methodName not specific</td> - </tr> - </table> -</p> +<ul> + <li><code class="highlighter-rouge">methodName</code> (optional) - execute this method if specific</li> + <li><code class="highlighter-rouge">resultName</code> (optional) - return this result if methodName not specific</li> +</ul> <h2 id="examples">Examples</h2> @@ -184,7 +166,6 @@ </code></pre> </div> - </section> </article> diff --git a/content/core-developers/int-range-field-validator-annotation.html b/content/core-developers/int-range-field-validator-annotation.html index b8de9b8..4a83b4f 100644 --- a/content/core-developers/int-range-field-validator-annotation.html +++ b/content/core-developers/int-range-field-validator-annotation.html @@ -125,18 +125,18 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/int-range-field-validator-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="intrangefieldvalidator-annotation">IntRangeFieldValidator Annotation</h1> -<p> This validator checks that a numeric field has a value within a specified range. - If neither min nor max is set, nothing will be done. -</p> +<p>This validator checks that a numeric field has a value within a specified range. If neither <code class="highlighter-rouge">min</code> nor <code class="highlighter-rouge">max</code> is set, +nothing will be done.</p> <h2 id="usage">Usage</h2> -<p> <p>The annotation must be applied at method level.</p> -</p> +<p>The annotation must be applied at method level.</p> <h2 id="parameters">Parameters</h2> @@ -214,22 +214,18 @@ <td class="confluenceTd">Enable parsing of min/max value.</td> </tr> </table> - - <p>If neither <em>min</em> nor <em>max</em> is set, nothing will be done.</p> - - <p>The values for min and max must be inserted as String values so that "0" can be handled as a possible value.</p> </p> +<p>If neither <code class="highlighter-rouge">min</code> nor <code class="highlighter-rouge">max</code> is set, nothing will be done.</p> + <h2 id="examples">Examples</h2> <div class="highlighter-rouge"><pre class="highlight"><code> <span class="nd">@IntRangeFieldValidator</span><span class="o">(</span><span class="n">message</span> <span class="o">=</span> <span class="s">"Default message"</span><span class="o">,</span> <span class="n">key</span> <span class="o">=</span> <span class="s">"i18n.key"</span><span class="o">,</span> <span class="n">shortCircuit</span> <span class="o">=</span> <span class="kc">true</span><span class="o">,</span> <span class="n" [...] <span class="nd">@IntRangeFieldValidator</span><span class="o">(</span><span class="n">message</span> <span class="o">=</span> <span class="s">"Default message"</span><span class="o">,</span> <span class="n">key</span> <span class="o">=</span> <span class="s">"i18n.key"</span><span class="o">,</span> <span class="n">shortCircuit</span> <span class="o">=</span> <span class="kc">true</span><span class="o">,</span> <span class="n">minExpression</span> <span class="o">=</span> <span class=" [...] - </code></pre> </div> - </section> </article> diff --git a/content/core-developers/key-annotation.html b/content/core-developers/key-annotation.html index 5dc8109..4a5f0df 100644 --- a/content/core-developers/key-annotation.html +++ b/content/core-developers/key-annotation.html @@ -125,17 +125,17 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/key-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="key-annotation">Key Annotation</h1> -<p> <p>Sets the Key for type conversion.</p> -</p> +<p>Sets the Key for type conversion.</p> <h2 id="usage">Usage</h2> -<p> <p>The Key annotation must be applied at field or method level.</p> -</p> +<p>The <code class="highlighter-rouge">Key</code> annotation must be applied at field or method level.</p> <h2 id="parameters">Parameters</h2> @@ -164,11 +164,9 @@ <div class="highlighter-rouge"><pre class="highlight"><code> <span class="c1">// The key property for User objects within the users collection is the <code>userName</code> attribute.</span> <span class="nd">@Key</span><span class="o">(</span> <span class="n">value</span> <span class="o">=</span> <span class="n">java</span><span class="o">.</span><span class="na">lang</span><span class="o">.</span><span class="na">Long</span><span class="o">.</span><span class="na">class</span> <span class="o">)</span> <span class="kd">private</span> <span class="n">Map</span><span class="o"><</span><span class="n">Long</span><span class="o">,</span> <span class="n">User</span><span class="o">></span> <span class="n">userMap</span><span class="o">;</span> - </code></pre> </div> - </section> </article> diff --git a/content/core-developers/key-property-annotation.html b/content/core-developers/key-property-annotation.html index 27372ce..8a17d66 100644 --- a/content/core-developers/key-property-annotation.html +++ b/content/core-developers/key-property-annotation.html @@ -125,18 +125,19 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/key-property-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="keyproperty-annotation">KeyProperty Annotation</h1> -<p> <p>Sets the KeyProperty for type conversion.</p> -</p> +<p>Sets the <code class="highlighter-rouge">KeyProperty</code> for type conversion.</p> <h2 id="usage">Usage</h2> -<p> <p>The KeyProperty annotation must be applied at field or method level.</p> - <p>This annotation should be used with Generic types, if the key property of the key element needs to be specified.</p> -</p> +<p>The <code class="highlighter-rouge">KeyProperty</code> annotation must be applied at field or method level.</p> + +<p>This annotation should be used with Generic types, if the key property of the key element needs to be specified.</p> <h2 id="parameters">Parameters</h2> @@ -165,11 +166,9 @@ <div class="highlighter-rouge"><pre class="highlight"><code> <span class="c1">// The key property for User objects within the users collection is the <code>userName</code> attribute.</span> <span class="nd">@KeyProperty</span><span class="o">(</span> <span class="n">value</span> <span class="o">=</span> <span class="s">"userName"</span> <span class="o">)</span> <span class="kd">protected</span> <span class="n">List</span><span class="o"><</span><span class="n">User</span><span class="o">></span> <span class="n">users</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span> - </code></pre> </div> - </section> </article> diff --git a/content/core-developers/regex-field-validator-annotation.html b/content/core-developers/regex-field-validator-annotation.html index 61827a4..d9b12b6 100644 --- a/content/core-developers/regex-field-validator-annotation.html +++ b/content/core-developers/regex-field-validator-annotation.html @@ -125,17 +125,17 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/regex-field-validator-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="regexfieldvalidator-annotation">RegexFieldValidator Annotation</h1> -<p> Validates a string field using a regular expression. -</p> +<p>Validates a string field using a regular expression.</p> <h2 id="usage">Usage</h2> -<p> <p>The annotation must be applied at method level.</p> -</p> +<p>The annotation must be applied at method level.</p> <h2 id="parameters">Parameters</h2> @@ -198,7 +198,6 @@ </code></pre> </div> - </section> </article> diff --git a/content/core-developers/required-field-validator-annotation.html b/content/core-developers/required-field-validator-annotation.html index caf6497..0c362f6 100644 --- a/content/core-developers/required-field-validator-annotation.html +++ b/content/core-developers/required-field-validator-annotation.html @@ -125,17 +125,17 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/required-field-validator-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="requiredfieldvalidator-annotation">RequiredFieldValidator Annotation</h1> -<p> This validator checks that a field is non-null. -</p> +<p>This validator checks that a field is non-null.</p> <h2 id="usage">Usage</h2> -<p> <p>The annotation must be applied at method level.</p> -</p> +<p>The annotation must be applied at method level.</p> <h2 id="parameters">Parameters</h2> @@ -192,7 +192,6 @@ </code></pre> </div> - </section> </article> diff --git a/content/core-developers/required-string-validator-annotation.html b/content/core-developers/required-string-validator-annotation.html index 1e75f28..efe3c51 100644 --- a/content/core-developers/required-string-validator-annotation.html +++ b/content/core-developers/required-string-validator-annotation.html @@ -125,17 +125,17 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/required-string-validator-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="requiredstringvalidator-annotation">RequiredStringValidator Annotation</h1> -<p> This validator checks that a String field is not empty (i.e. non-null with a length > 0). -</p> +<p>This validator checks that a String field is not empty (i.e. non-null with a length > 0).</p> <h2 id="usage">Usage</h2> -<p> <p>The annotation must be applied at method level.</p> -</p> +<p>The annotation must be applied at method level.</p> <h2 id="parameters">Parameters</h2> @@ -198,7 +198,6 @@ </code></pre> </div> - </section> </article> diff --git a/content/core-developers/restful-action-mapper.html b/content/core-developers/restful-action-mapper.html index 6e723ea..3430d76 100644 --- a/content/core-developers/restful-action-mapper.html +++ b/content/core-developers/restful-action-mapper.html @@ -125,9 +125,19 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/restful-action-mapper.md" title="Edit this page on GitHub">Edit on GitHub</a> - <h1 id="restfulactionmapper">RestfulActionMapper</h1> + + <a href="action-mapper.html" title="back to ActionMapper"><< back to ActionMapper</a> + + <h1 class="no_toc" id="restfulactionmapper">RestfulActionMapper</h1> + +<ul id="markdown-toc"> + <li><a href="#restful2actionmapper" id="markdown-toc-restful2actionmapper">Restful2ActionMapper</a> <ul> + <li><a href="#example" id="markdown-toc-example">Example</a></li> + <li><a href="#unit-testing" id="markdown-toc-unit-testing">Unit testing</a></li> + </ul> + </li> +</ul> <p>A custom action mapper using the following format:</p> @@ -153,36 +163,36 @@ </code></pre> </div> -<p>Your action just needs a setArticleId() method, and requests such as /article/1, /article/2, etc will all map to that URL pattern.</p> +<p>Your action just needs a <code class="highlighter-rouge">setArticleId()</code> method, and requests such as <code class="highlighter-rouge">/article/1</code>, <code class="highlighter-rouge">/article/2</code>, etc will all map +to that URL pattern.</p> <h2 id="restful2actionmapper">Restful2ActionMapper</h2> -<p>Improved restful action mapper that adds several ReST-style improvements to action mapping, but supports fully-customized URL’s via XML. The two primary REST enhancements are:</p> +<p>Improved restful action mapper that adds several REST-style improvements to action mapping, but supports fully-customized +URL’s via XML. The two primary REST enhancements are:</p> <ul> - <li> - <p>If the method is not specified (via ‘!’ or ‘method:’ prefix), the method is “guessed” at using ReST-style conventions that examine the URL and the HTTP method.</p> - </li> - <li> - <p>Parameters are extracted from the action name, if parameter name/value pairs are specified using PARAM_NAME/PARAM_VALUE syntax.</p> - </li> + <li>If the method is not specified (via <code class="highlighter-rouge">!</code> or <code class="highlighter-rouge">method:</code> prefix), the method is <em>guessed</em> at using REST-style conventions +that examine the URL and the HTTP method.</li> + <li>Parameters are extracted from the action name, if parameter name/value pairs are specified using <code class="highlighter-rouge">PARAM_NAME/PARAM_VALUE</code> syntax.</li> </ul> -<p>These two improvements allow a GET request for ‘category/action/movie/Thrillers’ to be mapped to the action name ‘movie’ with an id of ‘Thrillers’ with an extra parameter named ‘category’ with a value of ‘action’. A single action mapping can then handle all CRUD operations using wildcards, e.g.</p> +<p>These two improvements allow a GET request for <code class="highlighter-rouge">category/action/movie/Thrillers</code> to be mapped to the action +name <code class="highlighter-rouge">movie</code> with an id of <code class="highlighter-rouge">Thrillers</code> with an extra parameter named <code class="highlighter-rouge">category</code> with a value of <code class="highlighter-rouge">action</code>. A single action +mapping can then handle all CRUD operations using wildcards, e.g.</p> -<div class="highlighter-rouge"><pre class="highlight"><code> -<action name="movie/*" className="app.MovieAction"> - <param name="id">{1}</param> +<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt"><action</span> <span class="na">name=</span><span class="s">"movie/*"</span> <span class="na">className=</span><span class="s">"app.MovieAction"</span><span class="nt">></span> + <span class="nt"><param</span> <span class="na">name=</span><span class="s">"id"</span><span class="nt">></span>{1}<span class="nt"></param></span> ... -</action> - +<span class="nt"></action></span> </code></pre> </div> <p>This mapper supports the following parameters:</p> <ul> - <li><em>struts.mapper.idParameterName</em> - if set, this value will be the name of the parameter under which the id is stored. The id will then be removed from the action name. This allows restful actions to not require wildcards.</li> + <li><code class="highlighter-rouge">struts.mapper.idParameterName</code> - if set, this value will be the name of the parameter under which the id is stored. +The id will then be removed from the action name. This allows restful actions to not require wildcards.</li> </ul> <p>The following URL’s will invoke its methods:</p> @@ -196,137 +206,133 @@ </thead> <tbody> <tr> - <td>GET: /movie/</td> + <td>GET: <code class="highlighter-rouge">/movie/</code></td> <td>method=”index”</td> </tr> <tr> - <td>GET: /movie/Thrillers</td> + <td>GET: <code class="highlighter-rouge">/movie/Thrillers</code></td> <td>method=”view”, id=”Thrillers”</td> </tr> <tr> - <td>GET: /movie/Thrillers!edit</td> + <td>GET: <code class="highlighter-rouge">/movie/Thrillers!edit</code></td> <td>method=”edit”, id=”Thrillers”</td> </tr> <tr> - <td>GET: /movie/new</td> + <td>GET: <code class="highlighter-rouge">/movie/new</code></td> <td>method=”editNew”</td> </tr> <tr> - <td>POST: /movie/</td> + <td>POST: <code class="highlighter-rouge">/movie/</code></td> <td>method=”create”</td> </tr> <tr> - <td>PUT: /movie/Thrillers</td> + <td>PUT: <code class="highlighter-rouge">/movie/Thrillers</code></td> <td>method=”update”, id=”Thrillers”</td> </tr> <tr> - <td>DELETE: /movie/Thrillers</td> + <td>DELETE: <code class="highlighter-rouge">/movie/Thrillers</code></td> <td>method=”remove”, id=”Thrillers”</td> </tr> </tbody> </table> -<p>To simulate the HTTP methods PUT and DELETE, since they aren’t supported by HTML, the HTTP parameter “__http_method” will be used.</p> - -<p>The syntax and design for this feature was inspired by the REST support in Ruby on Rails. See <a href="http://ryandaigle\.com/articles/2006/08/01/whats\-new\-in\-edge\-rails\-simply\-restful\-support\-and\-how\-to\-use\-it">Simple RESTful support</a>^[http://ryandaigle.com/articles/2006/08/01/whats-new-in-edge-rails-simply-restful-support-and-how-to-use-it]</p> +<p>To simulate the HTTP methods <code class="highlighter-rouge">PUT</code> and <code class="highlighter-rouge">DELETE</code>, since they aren’t supported by HTML, the HTTP parameter <code class="highlighter-rouge">__http_method</code> +will be used.</p> -<p><strong>Example</strong></p> +<p>The syntax and design for this feature was inspired by the REST support in Ruby on Rails. +See <a href="http://ryandaigle.com/articles/2006/08/01/whats-new-in-edge-rails-simply-restful-support-and-how-to-use-it">Simple RESTful support</a></p> -<p>To use the Restful2ActionMapper in an existing struts application we have to change the strus.mapper.class constant and let it point to the Restful2ActionMapper</p> +<h3 id="example">Example</h3> -<div class="highlighter-rouge"><pre class="highlight"><code> -<constant name="struts.mapper.class" value="org.apache.struts2.dispatcher.mapper.Restful2ActionMapper" /> +<p>To use the <code class="highlighter-rouge">Restful2ActionMapper</code> in an existing struts application we have to change the <code class="highlighter-rouge">struts.mapper.class</code> constant +and let it point to the <code class="highlighter-rouge">Restful2ActionMapper</code>:</p> +<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt"><constant</span> <span class="na">name=</span><span class="s">"struts.mapper.class"</span> <span class="na">value=</span><span class="s">"org.apache.struts2.dispatcher.mapper.Restful2ActionMapper"</span> <span class="nt">/></span> </code></pre> </div> -<p>The problem with the above approach is that we may break existing actions because the Restful2ActionMapper tries to guess the method name using conventions that aren’t applicable to normal action classes.</p> +<p>The problem with the above approach is that we may break existing actions because the <code class="highlighter-rouge">Restful2ActionMapper</code> tries +to guess the method name using conventions that aren’t applicable to normal action classes.</p> -<p>To overcome the above problem, we have to use a different action mapper depending on the url we want to process. REST actions will be processed by the Restful2ActionMapper and non-REST actions by the DefaultActionMapper</p> +<p>To overcome the above problem, we have to use a different action mapper depending on the url we want to process. +REST actions will be processed by the <code class="highlighter-rouge">Restful2ActionMapper</code> and non-REST actions by the <code class="highlighter-rouge">DefaultActionMapper</code>.</p> -<p>To achieve that we have to rely on namespaces and the PrefixBasedActionMapper that can choose which action mapper to use for a particular url based on a prefix (the action namespace).</p> +<p>To achieve that we have to rely on namespaces and the <code class="highlighter-rouge">PrefixBasedActionMapper</code> that can choose which action mapper +to use for a particular url based on a prefix (the action namespace).</p> <p>To put everything together, we create a package for our rest actions</p> -<div class="highlighter-rouge"><pre class="highlight"><code> -<package name="rest" namespace="/rest" extends="struts-default"> +<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt"><package</span> <span class="na">name=</span><span class="s">"rest"</span> <span class="na">namespace=</span><span class="s">"/rest"</span> <span class="na">extends=</span><span class="s">"struts-default"</span><span class="nt">></span> ....interceptor config - <action name="movie/*" class="app.MovieAction"> - <param name="id">{1}</param> + <span class="nt"><action</span> <span class="na">name=</span><span class="s">"movie/*"</span> <span class="na">class=</span><span class="s">"app.MovieAction"</span><span class="nt">></span> + <span class="nt"><param</span> <span class="na">name=</span><span class="s">"id"</span><span class="nt">></span>{1}<span class="nt"></param></span> ....results - </action> + <span class="nt"></action></span> .... -</package> - +<span class="nt"></package></span> </code></pre> </div> -<p>All other actions remain in their existing packages and namespaces we use the PrefixBasedActionMapper telling it to use the Restful2ActionMapper for actions in the /rest namespace and the DefaultActionMapper for all other actions</p> - -<div class="highlighter-rouge"><pre class="highlight"><code> -<constant name="struts.mapper.class" value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper" /> -<constant name="struts.mapper.prefixMapping" value="/rest:restful2,:struts" /> +<p>All other actions remain in their existing packages and namespaces we use the <code class="highlighter-rouge">PrefixBasedActionMapper</code> telling it to use +the <code class="highlighter-rouge">Restful2ActionMapper</code> for actions in the <code class="highlighter-rouge">/rest</code> namespace and the <code class="highlighter-rouge">DefaultActionMapper</code> for all other actions.</p> +<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt"><constant</span> <span class="na">name=</span><span class="s">"struts.mapper.class"</span> <span class="na">value=</span><span class="s">"org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper"</span> <span class="nt">/></span> +<span class="nt"><constant</span> <span class="na">name=</span><span class="s">"struts.mapper.prefixMapping"</span> <span class="na">value=</span><span class="s">"/rest:restful2,:struts"</span> <span class="nt">/></span> </code></pre> </div> -<p>For the Restful2ActionMapper to work we also have to set</p> - -<div class="highlighter-rouge"><pre class="highlight"><code> -<constant name="struts.enable.SlashesInActionNames" value="true" /> -<constant name="struts.mapper.alwaysSelectFullNamespace" value="false" /> +<p>For the <code class="highlighter-rouge">Restful2ActionMapper</code> to work we also have to set</p> +<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt"><constant</span> <span class="na">name=</span><span class="s">"struts.enable.SlashesInActionNames"</span> <span class="na">value=</span><span class="s">"true"</span> <span class="nt">/></span> +<span class="nt"><constant</span> <span class="na">name=</span><span class="s">"struts.mapper.alwaysSelectFullNamespace"</span> <span class="na">value=</span><span class="s">"false"</span> <span class="nt">/></span> </code></pre> </div> -<p><strong>Unit testing</strong></p> +<h3 id="unit-testing">Unit testing</h3> <p>Below you will find a simple unit test to test how to test actions when <code class="highlighter-rouge">Restful2ActionMapper</code> is used.</p> -<div class="highlighter-rouge"><pre class="highlight"><code> -public class MovieActionTest extends StrutsJUnit4TestCase<MovieActionTest>{ +<div class="highlighter-rouge"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">MovieActionTest</span> <span class="kd">extends</span> <span class="n">StrutsJUnit4TestCase</span><span class="o"><</span><span class="n">MovieActionTest</span><span class="o">>{</span> - @Before - public void setUp() throws Exception { - //assumes Basic authentication - super.setUp(); - String credentials = "username:password"; - request.addHeader("authorization", "BASIC " + Base64.encodeBase64String(credentials.getBytes())); - } + <span class="nd">@Before</span> + <span class="kd">public</span> <span class="kt">void</span> <span class="n">setUp</span><span class="o">()</span> <span class="kd">throws</span> <span class="n">Exception</span> <span class="o">{</span> + <span class="c1">//assumes Basic authentication</span> + <span class="kd">super</span><span class="o">.</span><span class="na">setUp</span><span class="o">();</span> + <span class="n">String</span> <span class="n">credentials</span> <span class="o">=</span> <span class="s">"username:password"</span><span class="o">;</span> + <span class="n">request</span><span class="o">.</span><span class="na">addHeader</span><span class="o">(</span><span class="s">"authorization"</span><span class="o">,</span> <span class="s">"BASIC "</span> <span class="o">+</span> <span class="n">Base64</span><span class="o">.</span><span class="na">encodeBase64String</span><span class="o">(</span><span class="n">credentials</span><span class="o">.</span><span class="na">getBytes</span><span class="o">()));</span> + <span class="o">}</span> - @Test - public void testIndex() throws Exception { - request.setMethod("get"); //Http method should be set + <span class="nd">@Test</span> + <span class="kd">public</span> <span class="kt">void</span> <span class="n">testIndex</span><span class="o">()</span> <span class="kd">throws</span> <span class="n">Exception</span> <span class="o">{</span> + <span class="n">request</span><span class="o">.</span><span class="na">setMethod</span><span class="o">(</span><span class="s">"get"</span><span class="o">);</span> <span class="c1">//Http method should be set</span> - ActionProxy proxy = getActionProxy("/rest/movie/"); + <span class="n">ActionProxy</span> <span class="n">proxy</span> <span class="o">=</span> <span class="n">getActionProxy</span><span class="o">(</span><span class="s">"/rest/movie/"</span><span class="o">);</span> - proxy.setExecuteResult(false); - String result = proxy.execute(); + <span class="n">proxy</span><span class="o">.</span><span class="na">setExecuteResult</span><span class="o">(</span><span class="kc">false</span><span class="o">);</span> + <span class="n">String</span> <span class="n">result</span> <span class="o">=</span> <span class="n">proxy</span><span class="o">.</span><span class="na">execute</span><span class="o">();</span> - //assertions ... - } + <span class="c1">//assertions ... </span> + <span class="o">}</span> - @Test - public void testView() throws Exception { - request.setMethod("get"); //Http method should be set + <span class="nd">@Test</span> + <span class="kd">public</span> <span class="kt">void</span> <span class="n">testView</span><span class="o">()</span> <span class="kd">throws</span> <span class="n">Exception</span> <span class="o">{</span> + <span class="n">request</span><span class="o">.</span><span class="na">setMethod</span><span class="o">(</span><span class="s">"get"</span><span class="o">);</span> <span class="c1">//Http method should be set</span> - ActionProxy proxy = getActionProxy("/rest/movie/1"); - MovieAction movieAction = MovieAction.class.cast(proxy.getAction()); + <span class="n">ActionProxy</span> <span class="n">proxy</span> <span class="o">=</span> <span class="n">getActionProxy</span><span class="o">(</span><span class="s">"/rest/movie/1"</span><span class="o">);</span> + <span class="n">MovieAction</span> <span class="n">movieAction</span> <span class="o">=</span> <span class="n">MovieAction</span><span class="o">.</span><span class="na">class</span><span class="o">.</span><span class="na">cast</span><span class="o">(</span><span class="n">proxy</span><span class="o">.</span><span class="na">getAction</span><span class="o">());</span> - proxy.setExecuteResult(false); + <span class="n">proxy</span><span class="o">.</span><span class="na">setExecuteResult</span><span class="o">(</span><span class="kc">false</span><span class="o">);</span> - String result = proxy.execute(); - //assertions ... - assertEquals("1", movieAction.getId()); - } -} - + <span class="n">String</span> <span class="n">result</span> <span class="o">=</span> <span class="n">proxy</span><span class="o">.</span><span class="na">execute</span><span class="o">();</span> + <span class="c1">//assertions ...</span> + <span class="n">assertEquals</span><span class="o">(</span><span class="s">"1"</span><span class="o">,</span> <span class="n">movieAction</span><span class="o">.</span><span class="na">getId</span><span class="o">());</span> + <span class="o">}</span> +<span class="o">}</span> </code></pre> </div> <p>Thanks to Antonios Gkogkakis for the examples!</p> - </section> </article> diff --git a/content/core-developers/string-length-field-validator-annotation.html b/content/core-developers/string-length-field-validator-annotation.html index e32a105..09507b8 100644 --- a/content/core-developers/string-length-field-validator-annotation.html +++ b/content/core-developers/string-length-field-validator-annotation.html @@ -125,18 +125,18 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/string-length-field-validator-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="stringlengthfieldvalidator-annotation">StringLengthFieldValidator Annotation</h1> -<p> This validator checks that a String field is of the right length. It assumes that the field is a String. - If neither minLength nor maxLength is set, nothing will be done. -</p> +<p>This validator checks that a String field is of the right length. It assumes that the field is a String. +If neither <code class="highlighter-rouge">minLength</code> nor <code class="highlighter-rouge">maxLength</code> is set, nothing will be done.</p> <h2 id="usage">Usage</h2> -<p> <p>The annotation must be applied at method level.</p> -</p> +<p>The annotation must be applied at method level.</p> <h2 id="parameters">Parameters</h2> @@ -214,19 +214,16 @@ <td class="confluenceTd">OGNL expression used to obtain the maximum length the String can be. </td> </tr> </table> - - <p>If neither <em>minLength</em> nor <em>maxLength</em> is set, nothing will be done.</p> - </p> +<p>If neither <code class="highlighter-rouge">minLength</code> nor <code class="highlighter-rouge">maxLength</code> is set, nothing will be done.</p> + <h2 id="examples">Examples</h2> <div class="highlighter-rouge"><pre class="highlight"><code> <span class="nd">@StringLengthFieldValidator</span><span class="o">(</span><span class="n">message</span> <span class="o">=</span> <span class="s">"Default message"</span><span class="o">,</span> <span class="n">key</span> <span class="o">=</span> <span class="s">"i18n.key"</span><span class="o">,</span> <span class="n">shortCircuit</span> <span class="o">=</span> <span class="kc">true</span><span class="o">,</span> <span class [...] - </code></pre> </div> - </section> </article> diff --git a/content/core-developers/type-conversion-annotation.html b/content/core-developers/type-conversion-annotation.html index 26a2f2a..2c94b11 100644 --- a/content/core-developers/type-conversion-annotation.html +++ b/content/core-developers/type-conversion-annotation.html @@ -125,30 +125,33 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/type-conversion-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="typeconversion-annotation">TypeConversion Annotation</h1> -<p> <p>This annotation is used for class and application wide conversion rules.</p> +<p>This annotation is used for class and application wide conversion rules.</p> - <p> - Class wide conversion:<br /> - The conversion rules will be assembled in a file called <code>XXXAction-conversion.properties</code> - within the same package as the related action class. - Set type to: <code>type = ConversionType.CLASS</code> - </p> +<ul> + <li> + <p>Class wide conversion:</p> - <p> - Application wide conversion:<br /> - The conversion rules will be assembled within the <code>xwork-conversion.properties</code> file within the classpath root. - Set type to: <code>type = ConversionType.APPLICATION</code> - </p> -</p> + <p>The conversion rules will be assembled in a file called <code class="highlighter-rouge">XXXAction-conversion.properties</code> within the same package +as the related action class. +Set type to: <code class="highlighter-rouge">type = ConversionType.CLASS</code></p> + </li> + <li> + <p>Application wide conversion:</p> + + <p>The conversion rules will be assembled within the <code class="highlighter-rouge">xwork-conversion.properties</code> file within the classpath root. + Set type to: <code class="highlighter-rouge">type = ConversionType.APPLICATION</code></p> + </li> +</ul> <h2 id="usage">Usage</h2> -<p> <p>The TypeConversion annotation can be applied at property and method level.</p> -</p> +<p>The <code class="highlighter-rouge">TypeConversion</code> annotation can be applied at property and method level.</p> <h2 id="parameters">Parameters</h2> @@ -240,11 +243,9 @@ <span class="k">return</span> <span class="n">SUCCESS</span><span class="o">;</span> <span class="o">}</span> <span class="o">}</span> - </code></pre> </div> - </section> </article> diff --git a/content/core-developers/url-validator-annotation.html b/content/core-developers/url-validator-annotation.html index 388e18f..7c4ff40 100644 --- a/content/core-developers/url-validator-annotation.html +++ b/content/core-developers/url-validator-annotation.html @@ -125,17 +125,19 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/url-validator-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="urlvalidator-annotation">UrlValidator Annotation</h1> <p>This validator checks that a field is a valid URL.</p> -<p>Usage</p> +<h2 id="usage">Usage</h2> <p> The annotation must be applied at method level.</p> -<p>Parameters</p> +<h2 id="parameters">Parameters</h2> <table> <thead> @@ -198,60 +200,39 @@ </tbody> </table> -<p>Examples</p> +<h2 id="examples">Examples</h2> -<p><strong>UrlValidator usage example</strong></p> +<h3 id="urlvalidator-usage-example">UrlValidator usage example</h3> -<div class="highlighter-rouge"><pre class="highlight"><code>@UrlValidator(message = "Default message", key = "i18n.key", shortCircuit = true) +<div class="highlighter-rouge"><pre class="highlight"><code><span class="nd">@UrlValidator</span><span class="o">(</span><span class="n">message</span> <span class="o">=</span> <span class="s">"Default message"</span><span class="o">,</span> <span class="n">key</span> <span class="o">=</span> <span class="s">"i18n.key"</span><span class="o">,</span> <span class="n">shortCircuit</span> <span class="o">=</span> <span class="kc">true</span><span class="o">)</span> </code></pre> </div> -<p><strong>UrlValidator usage example</strong></p> +<h3 id="urlvalidator-usage-example-1">UrlValidator usage example</h3> -<div class="highlighter-rouge"><pre class="highlight"><code>@UrlValidator(message = "Default message", key = "i18n.key", urlRegexExpression = "${urlRegex}") +<div class="highlighter-rouge"><pre class="highlight"><code><span class="nd">@UrlValidator</span><span class="o">(</span><span class="n">message</span> <span class="o">=</span> <span class="s">"Default message"</span><span class="o">,</span> <span class="n">key</span> <span class="o">=</span> <span class="s">"i18n.key"</span><span class="o">,</span> <span class="n">urlRegexExpression</span> <span class="o">=</span> <span class="s">"${urlRegex}"</span><span class="o">)</span> </code></pre> </div> -<table> - <tbody> - <tr> - <td>urlRegex neither urlRegexExpression are only used on client side to validate URLs - this will be changed with next major release!</td> - </tr> - </tbody> -</table> - -<table> - <tbody> - <tr> - </tr> - </tbody> -</table> - -<p>If no urlRegex neither urlRegexExpression is defined, default regex will be used instead, based on <a href="http://stackoverflow\.com/questions/161738/what\-is\-the\-best\-regular\-expression\-to\-check\-if\-a\-string\-is\-a\-valid\-url">StackOverflow answer</a>^[http://stackoverflow.com/questions/161738/what-is-the-best-regular-expression-to-check-if-a-string-is-a-valid-url]</p> - -<table> - <tbody> - <tr> - </tr> - </tbody> -</table> +<p>If no <code class="highlighter-rouge">urlRegex</code> neither <code class="highlighter-rouge">urlRegexExpression</code> is defined, default regex will be used instead, +based on <a href="http://stackoverflow.com/questions/161738/what-is-the-best-regular-expression-to-check-if-a-string-is-a-valid-url">StackOverflow answer</a></p> -<p><strong>Default URL regex</strong></p> +<h3 id="default-url-regex">Default URL regex</h3> -<div class="highlighter-rouge"><pre class="highlight"><code>return "^(https?|ftp):\/\/" + - "(([a-z0-9$_\\.\\+!\\*\\'\\(\\),;\\?&=-]|%[0-9a-f]{2})+" + - "(:([a-z0-9$_\\.\\+!\\*\\'\\(\\),;\\?&=-]|%[0-9a-f]{2})+)?" + - "@)?(#?" + - ")((([a-z0-9]\\.|[a-z0-9][a-z0-9-]*[a-z0-9]\\.)*" + - "[a-z][a-z0-9-]*[a-z0-9]" + - "|((\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])\\.){3}" + - "(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])" + - ")(:\\d+)?" + - ")(((\\/+([a-z0-9$_\\.\\+!\\*\\'\\(\\),;:@&=-]|%[0-9a-f]{2})*)*" + - "(\\?([a-z0-9$_\\.\\+!\\*\\'\\(\\),;:@&=-]|%[0-9a-f]{2})*)" + - "?)?)?" + - "(#([a-z0-9$_\\.\\+!\\*\\'\\(\\),;:@&=-]|%[0-9a-f]{2})*)?" + - "$"; +<div class="highlighter-rouge"><pre class="highlight"><code><span class="k">return</span> <span class="s">"^(https?|ftp):\/\/"</span> <span class="o">+</span> + <span class="s">"(([a-z0-9$_\.\\+!\\*\\'\\(\\),;\\?&=-]|%[0-9a-f]{2})+"</span> <span class="o">+</span> + <span class="s">"(:([a-z0-9$_\.\\+!\\*\\'\\(\\),;\\?&=-]|%[0-9a-f]{2})+)?"</span> <span class="o">+</span> + <span class="s">"@)?(#?"</span> <span class="o">+</span> + <span class="s">")((([a-z0-9]\.|[a-z0-9][a-z0-9-]*[a-z0-9]\.)*"</span> <span class="o">+</span> + <span class="s">"[a-z][a-z0-9-]*[a-z0-9]"</span> <span class="o">+</span> + <span class="s">"|((\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])\.){3}"</span> <span class="o">+</span> + <span class="s">"(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])"</span> <span class="o">+</span> + <span class="s">")(:\\d+)?"</span> <span class="o">+</span> + <span class="s">")(((\\/+([a-z0-9$_\.\\+!\\*\\'\\(\\),;:@&=-]|%[0-9a-f]{2})*)*"</span> <span class="o">+</span> + <span class="s">"(\\?([a-z0-9$_\.\\+!\\*\\'\\(\\),;:@&=-]|%[0-9a-f]{2})*)"</span> <span class="o">+</span> + <span class="s">"?)?)?"</span> <span class="o">+</span> + <span class="s">"(#([a-z0-9$_\.\\+!\\*\\'\\(\\),;:@&=-]|%[0-9a-f]{2})*)?"</span> <span class="o">+</span> + <span class="s">"$"</span><span class="o">;</span> </code></pre> </div> diff --git a/content/core-developers/validation-annotation.html b/content/core-developers/validation-annotation.html index c5044d1..01fce6d 100644 --- a/content/core-developers/validation-annotation.html +++ b/content/core-developers/validation-annotation.html @@ -125,48 +125,32 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/validation-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="validation-annotation">Validation Annotation</h1> -<p> This annotation has been deprecated since 2.1 as its previous purpose, to define classes that support annotation validations, - is no longer necessary. -</p> +<p>This annotation has been deprecated since Struts 2.1 as its previous purpose, to define classes that support annotation validations, +is no longer necessary.</p> <h2 id="usage">Usage</h2> -<p> <p>The Validation annotation must be applied at Type level.</p> -</p> +<p>Validation annotation must be applied at Type level.</p> <h2 id="parameters">Parameters</h2> -<p> <table class="confluenceTable" summary=""> - <tr> - <th class="confluenceTh"> Parameter </th> - <th class="confluenceTh"> Required </th> - <th class="confluenceTh"> Default </th> - <th class="confluenceTh"> Notes </th> - </tr> - <tr> - <td class="confluenceTd">validations</td> - <td class="confluenceTd">yes</td> - <td class="confluenceTd"> </td> - <td class="confluenceTd"></td> - </tr> - </table> -</p> +<ul> + <li><code class="highlighter-rouge">validations</code> - list of validations to apply</li> +</ul> <h2 id="examples">Examples</h2> -<p><strong>An Annotated Interface</strong></p> +<h3 id="an-annotated-interface">An Annotated Interface</h3> <ul> - <li> - <p>Mark the interface with @Validation()</p> - </li> - <li> - <p>Apply standard or custom annoations at method level</p> - </li> + <li>Mark the interface with <code class="highlighter-rouge">@Validation()</code></li> + <li>Apply standard or custom annotations at method level</li> </ul> <div class="highlighter-rouge"><pre class="highlight"><code> <span class="nd">@Validation</span><span class="o">()</span> @@ -186,7 +170,7 @@ </code></pre> </div> -<p><strong>An Annotated Class</strong></p> +<h3 id="an-annotated-class">An Annotated Class</h3> <div class="highlighter-rouge"><pre class="highlight"><code> <span class="nd">@Validation</span><span class="o">()</span> <span class="kd">public</span> <span class="kd">class</span> <span class="nc">SimpleAnnotationAction</span> <span class="kd">extends</span> <span class="n">ActionSupport</span> <span class="o">{</span> @@ -229,31 +213,19 @@ <span class="o">}</span> <span class="o">}</span> - </code></pre> </div> -<blockquote> - -</blockquote> - -<blockquote> - -</blockquote> - -<blockquote> - <p>When multiple methods are used to map different actions on the same class, and one of them is annotated with <em>@Validations</em> , those validators will be triggered for all the actions, unless they are annotated with @SkipValidation or <em>validateAnnotatedMethodOnly</em> is set to <em>true</em> in the “validation” interceptor, like:</p> -</blockquote> - -<blockquote> - - <p><interceptor-ref name=”validation”> - <param name=”validateAnnotatedMethodOnly”>true</param> - <param name=”excludeMethods”>input,back,cancel,browse</param> -</interceptor-ref></p> - -</blockquote> +<p>When multiple methods are used to map different actions on the same class, and one of them is annotated with <code class="highlighter-rouge">@Validations</code>, +those validators will be triggered for all the actions, unless they are annotated with <code class="highlighter-rouge">@SkipValidation</code> or <code class="highlighter-rouge">validateAnnotatedMethodOnly</code> +is set to <code class="highlighter-rouge">true</code> in the <code class="highlighter-rouge">validation</code> interceptor, like:</p> +<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt"><interceptor-ref</span> <span class="na">name=</span><span class="s">"validation"</span><span class="nt">></span> + <span class="nt"><param</span> <span class="na">name=</span><span class="s">"validateAnnotatedMethodOnly"</span><span class="nt">></span>true<span class="nt"></param></span> + <span class="nt"><param</span> <span class="na">name=</span><span class="s">"excludeMethods"</span><span class="nt">></span>input,back,cancel,browse<span class="nt"></param></span> +<span class="nt"></interceptor-ref></span> +</code></pre> +</div> </section> </article> diff --git a/content/core-developers/validations-annotation.html b/content/core-developers/validations-annotation.html index 510f1f2..f9049c2 100644 --- a/content/core-developers/validations-annotation.html +++ b/content/core-developers/validations-annotation.html @@ -125,17 +125,17 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/validations-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="validations-annotation">Validations Annotation</h1> -<p> <p>If you want to use several annotations of the same type, these annotations must be nested within the @Validations() annotation.</p> -</p> +<p>If you want to use several annotations of the same type, these annotations must be nested within the <code class="highlighter-rouge">@Validations()</code> annotation.</p> <h2 id="usage">Usage</h2> -<p> <p>Used at METHOD level.</p> -</p> +<p>Used at METHOD level.</p> <h2 id="parameters">Parameters</h2> @@ -256,60 +256,49 @@ <p>Different validations per method is NOT supported for client-side validation!</p> -<table> - <tbody> - <tr> - </tr> - </tbody> -</table> - -<p>To use different validations per method, the validateAnnotatedMethodOnly property must be set on the validation interceptor.</p> - -<div class="highlighter-rouge"><pre class="highlight"><code> -<interceptor-ref name="validation"> - <param name="validateAnnotatedMethodOnly">true</param> - <param name="excludeMethods">input,back,cancel,browse</param> -</interceptor-ref> +<p>To use different validations per method, the <code class="highlighter-rouge">validateAnnotatedMethodOnly</code> property must be set on the validation interceptor.</p> +<div class="highlighter-rouge"><pre class="highlight"><code><span class="nt"><interceptor-ref</span> <span class="na">name=</span><span class="s">"validation"</span><span class="nt">></span> + <span class="nt"><param</span> <span class="na">name=</span><span class="s">"validateAnnotatedMethodOnly"</span><span class="nt">></span>true<span class="nt"></param></span> + <span class="nt"><param</span> <span class="na">name=</span><span class="s">"excludeMethods"</span><span class="nt">></span>input,back,cancel,browse<span class="nt"></param></span> +<span class="nt"></interceptor-ref></span> </code></pre> </div> <p>Here’s a complete example of updating the default stack:</p> -<div class="highlighter-rouge"><pre class="highlight"><code> - <package name="default" extends="struts-default"> - <interceptors> - <interceptor-stack name="content"> - <interceptor-ref name="exception"/> - <interceptor-ref name="alias"/> - <interceptor-ref name="servletConfig"/> - <interceptor-ref name="prepare"/> - <interceptor-ref name="i18n"/> - <interceptor-ref name="chain"/> - <interceptor-ref name="debugging"/> - <interceptor-ref name="profiling"/> - <interceptor-ref name="scopedModelDriven"/> - <interceptor-ref name="modelDriven"/> - <interceptor-ref name="fileUpload"/> - <interceptor-ref name="checkbox"/> - <interceptor-ref name="staticParams"/> - <interceptor-ref name="params"> - <param name="excludeParams">dojo\..*</param> - </interceptor-ref> - <interceptor-ref name="conversionError"/> - <interceptor-ref name="validation"> - <param name="validateAnnotatedMethodOnly">true</param> - <param name="excludeMethods">input,back,cancel,browse</param> - </interceptor-ref> - <interceptor-ref name="workflow"> - <param name="excludeMethods">input,back,cancel,browse</param> - </interceptor-ref> - </interceptor-stack> - </interceptors> - <default-interceptor-ref name="default"/> - </package> -</struts> - +<div class="highlighter-rouge"><pre class="highlight"><code> <span class="nt"><package</span> <span class="na">name=</span><span class="s">"default"</span> <span class="na">extends=</span><span class="s">"struts-default"</span><span class="nt">></span> + <span class="nt"><interceptors></span> + <span class="nt"><interceptor-stack</span> <span class="na">name=</span><span class="s">"content"</span><span class="nt">></span> + <span class="nt"><interceptor-ref</span> <span class="na">name=</span><span class="s">"exception"</span><span class="nt">/></span> + <span class="nt"><interceptor-ref</span> <span class="na">name=</span><span class="s">"alias"</span><span class="nt">/></span> + <span class="nt"><interceptor-ref</span> <span class="na">name=</span><span class="s">"servletConfig"</span><span class="nt">/></span> + <span class="nt"><interceptor-ref</span> <span class="na">name=</span><span class="s">"prepare"</span><span class="nt">/></span> + <span class="nt"><interceptor-ref</span> <span class="na">name=</span><span class="s">"i18n"</span><span class="nt">/></span> + <span class="nt"><interceptor-ref</span> <span class="na">name=</span><span class="s">"chain"</span><span class="nt">/></span> + <span class="nt"><interceptor-ref</span> <span class="na">name=</span><span class="s">"debugging"</span><span class="nt">/></span> + <span class="nt"><interceptor-ref</span> <span class="na">name=</span><span class="s">"profiling"</span><span class="nt">/></span> + <span class="nt"><interceptor-ref</span> <span class="na">name=</span><span class="s">"scopedModelDriven"</span><span class="nt">/></span> + <span class="nt"><interceptor-ref</span> <span class="na">name=</span><span class="s">"modelDriven"</span><span class="nt">/></span> + <span class="nt"><interceptor-ref</span> <span class="na">name=</span><span class="s">"fileUpload"</span><span class="nt">/></span> + <span class="nt"><interceptor-ref</span> <span class="na">name=</span><span class="s">"checkbox"</span><span class="nt">/></span> + <span class="nt"><interceptor-ref</span> <span class="na">name=</span><span class="s">"staticParams"</span><span class="nt">/></span> + <span class="nt"><interceptor-ref</span> <span class="na">name=</span><span class="s">"params"</span><span class="nt">></span> + <span class="nt"><param</span> <span class="na">name=</span><span class="s">"excludeParams"</span><span class="nt">></span>dojo\..*<span class="nt"></param></span> + <span class="nt"></interceptor-ref></span> + <span class="nt"><interceptor-ref</span> <span class="na">name=</span><span class="s">"conversionError"</span><span class="nt">/></span> + <span class="nt"><interceptor-ref</span> <span class="na">name=</span><span class="s">"validation"</span><span class="nt">></span> + <span class="nt"><param</span> <span class="na">name=</span><span class="s">"validateAnnotatedMethodOnly"</span><span class="nt">></span>true<span class="nt"></param></span> + <span class="nt"><param</span> <span class="na">name=</span><span class="s">"excludeMethods"</span><span class="nt">></span>input,back,cancel,browse<span class="nt"></param></span> + <span class="nt"></interceptor-ref></span> + <span class="nt"><interceptor-ref</span> <span class="na">name=</span><span class="s">"workflow"</span><span class="nt">></span> + <span class="nt"><param</span> <span class="na">name=</span><span class="s">"excludeMethods"</span><span class="nt">></span>input,back,cancel,browse<span class="nt"></param></span> + <span class="nt"></interceptor-ref></span> + <span class="nt"></interceptor-stack></span> + <span class="nt"></interceptors></span> + <span class="nt"><default-interceptor-ref</span> <span class="na">name=</span><span class="s">"default"</span><span class="nt">/></span> + <span class="nt"></package></span> +<span class="nt"></struts></span> </code></pre> </div> diff --git a/content/core-developers/visitor-field-validator-annotation.html b/content/core-developers/visitor-field-validator-annotation.html index 658d984..df0c6cb 100644 --- a/content/core-developers/visitor-field-validator-annotation.html +++ b/content/core-developers/visitor-field-validator-annotation.html @@ -125,24 +125,24 @@ <article class="container"> <section class="col-md-12"> - <a href="index.html" title="back to Core Developers Guide"><< back to Core Developers Guide</a> <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/visitor-field-validator-annotation.md" title="Edit this page on GitHub">Edit on GitHub</a> + + <a href="annotations.html" title="back to Annotations"><< back to Annotations</a> + <h1 id="visitorfieldvalidator-annotation">VisitorFieldValidator Annotation</h1> -<p> The validator allows you to forward validator to object properties of your action - using the objects own validator files. This allows you to use the ModelDriven development - pattern and manage your validations for your models in one place, where they belong, next to - your model classes. +<p>The validator allows you to forward validator to object properties of your action +using the objects own validator files. This allows you to use the <code class="highlighter-rouge">ModelDriven</code> development +pattern and manage your validations for your models in one place, where they belong, next to +your model classes.</p> - The VisitorFieldValidator can handle either simple Object properties, Collections of Objects, or Arrays. - The error message for the VisitorFieldValidator will be appended in front of validator messages added - by the validations for the Object message. -</p> +<p>The <code class="highlighter-rouge">VisitorFieldValidator</code> can handle either simple Object properties, Collections of Objects, or Arrays. +The error message for the <code class="highlighter-rouge">VisitorFieldValidator</code> will be appended in front of validator messages added +by the validations for the Object message.</p> <h2 id="usage">Usage</h2> -<p> <p>The annotation must be applied at method level.</p> -</p> +<p>The annotation must be applied at method level.</p> <h2 id="parameters">Parameters</h2> @@ -201,11 +201,9 @@ <h2 id="examples">Examples</h2> <div class="highlighter-rouge"><pre class="highlight"><code> <span class="nd">@VisitorFieldValidator</span><span class="o">(</span><span class="n">message</span> <span class="o">=</span> <span class="s">"Default message"</span><span class="o">,</span> <span class="n">key</span> <span class="o">=</span> <span class="s">"i18n.key"</span><span class="o">,</span> <span class="n">shortCircuit</span> <span class="o">=</span> <span class="kc">true</span><span class="o">,</span> <span class="n"> [...] - </code></pre> </div> - </section> </article> -- To stop receiving notification emails like this one, please contact ['"commits@struts.apache.org" <commits@struts.apache.org>'].