Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B80FB200D0B for ; Wed, 27 Sep 2017 20:25:44 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B5FE01609CA; Wed, 27 Sep 2017 18:25:44 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 66FBC1609C1 for ; Wed, 27 Sep 2017 20:25:38 +0200 (CEST) Received: (qmail 28121 invoked by uid 500); 27 Sep 2017 18:25:32 -0000 Mailing-List: contact commits-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list commits@struts.apache.org Received: (qmail 28112 invoked by uid 99); 27 Sep 2017 18:25:32 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Sep 2017 18:25:32 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 71AF68191E; Wed, 27 Sep 2017 18:25:28 +0000 (UTC) Date: Wed, 27 Sep 2017 18:25:28 +0000 To: "commits@struts.apache.org" Subject: [struts-site] branch asf-site updated: Updates production by Jenkins MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <150653672861.29482.1740924299189372377@gitbox.apache.org> From: git-site-role@apache.org Reply-To: "commits@struts.apache.org" X-Git-Host: gitbox.apache.org X-Git-Repo: struts-site X-Git-Refname: refs/heads/asf-site X-Git-Reftype: branch X-Git-Oldrev: 8ae801d86070ec60af2dec653429fa7d8e1831cb X-Git-Newrev: 0a0b0f44a9a9f438f3bc96ed1b0719f52c9150c4 X-Git-Rev: 0a0b0f44a9a9f438f3bc96ed1b0719f52c9150c4 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated archived-at: Wed, 27 Sep 2017 18:25:44 -0000 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 0a0b0f4 Updates production by Jenkins 0a0b0f4 is described below commit 0a0b0f44a9a9f438f3bc96ed1b0719f52c9150c4 Author: jenkins AuthorDate: Wed Sep 27 18:25:26 2017 +0000 Updates production by Jenkins --- content/core-developers/action-mapper.html | 46 +- content/core-developers/after-annotation.html | 46 +- content/core-developers/alias-interceptor.html | 45 +- .../annotation-workflow-interceptor.html | 60 +- content/core-developers/basic-validation.html | 24 +- content/core-developers/before-annotation.html | 45 +- .../core-developers/before-result-annotation.html | 45 +- content/core-developers/checkbox-interceptor.html | 10 +- content/core-developers/client-validation.html | 24 +- content/core-developers/conversion-annotation.html | 56 +- ...onversion-error-field-validator-annotation.html | 64 +- .../conversion-error-interceptor.html | 56 +- content/core-developers/cookie-interceptor.html | 133 +- .../cookie-provider-interceptor.html | 34 +- .../core-developers/create-if-null-annotation.html | 38 +- .../create-session-interceptor.html | 43 +- .../custom-validator-annotation.html | 63 +- .../date-range-field-validator-annotation.html | 101 +- content/core-developers/debugging-interceptor.html | 34 +- .../default-workflow-interceptor.html | 105 +- .../double-range-field-validator-annotation.html | 116 +- content/core-developers/element-annotation.html | 29 +- .../email-validator-annotation.html | 63 +- content/core-developers/exception-interceptor.html | 71 +- .../execute-and-wait-interceptor.html | 132 +- .../expression-validator-annotation.html | 57 +- .../field-expression-validator-annotation.html | 65 +- .../core-developers/file-upload-interceptor.html | 131 +- content/core-developers/file-upload.html | 11 +- .../core-developers/input-config-annotation.html | 55 +- .../int-range-field-validator-annotation.html | 100 +- content/core-developers/key-annotation.html | 39 +- .../core-developers/key-property-annotation.html | 40 +- content/core-developers/logger-interceptor.html | 36 +- .../parameter-filter-interceptor.html | 44 +- content/core-developers/postback-result.html | 16 +- content/core-developers/prepare-interceptor.html | 76 +- .../pure-java-script-client-side-validation.html | 4 +- .../core-developers/redirect-action-result.html | 88 +- content/core-developers/redirect-result.html | 48 +- .../regex-field-validator-annotation.html | 69 +- .../required-field-validator-annotation.html | 63 +- .../required-string-validator-annotation.html | 69 +- content/core-developers/roles-interceptor.html | 33 +- content/core-developers/scope-interceptor.html | 99 +- .../scoped-model-driven-interceptor.html | 47 +- .../servlet-config-interceptor.html | 62 +- .../static-parameters-interceptor.html | 40 +- .../string-length-field-validator-annotation.html | 97 +- content/core-developers/timer-interceptor.html | 47 +- content/core-developers/token-interceptor.html | 75 +- .../core-developers/token-session-interceptor.html | 58 +- .../type-conversion-annotation.html | 115 +- .../core-developers/using-field-validators.html | 24 +- .../using-non-field-validators.html | 24 +- .../using-visitor-field-validator.html | 24 +- content/core-developers/validation-annotation.html | 94 +- .../core-developers/validation-interceptor.html | 91 +- .../validation-parameter-annotation.html | 43 +- .../core-developers/validations-annotation.html | 123 +- content/core-developers/velocity-result.html | 16 +- .../visitor-field-validator-annotation.html | 76 +- content/tag-developers/action-tag.html | 60 +- content/tag-developers/actionerror-tag.html | 25 +- content/tag-developers/actionmessage-tag.html | 23 +- content/tag-developers/ajax-common-header.html | 1362 ++++++++++++++------ content/tag-developers/append-tag.html | 78 +- content/tag-developers/bean-tag.html | 51 +- content/tag-developers/checkbox-tag.html | 24 +- content/tag-developers/checkboxlist-tag.html | 32 +- content/tag-developers/combobox-tag.html | 63 +- content/tag-developers/component-tag.html | 102 +- content/tag-developers/date-tag.html | 110 +- content/tag-developers/datetextfield-tag.html | 16 +- content/tag-developers/div-tag.html | 8 +- content/tag-developers/dojo-a-tag.html | 56 +- content/tag-developers/dojo-autocompleter-tag.html | 80 +- content/tag-developers/dojo-bind-tag.html | 56 +- .../tag-developers/dojo-datetimepicker-tag.html | 32 +- content/tag-developers/dojo-div-tag.html | 32 +- content/tag-developers/dojo-head-tag.html | 36 +- content/tag-developers/dojo-submit-tag.html | 80 +- content/tag-developers/dojo-tabbedpanel-tag.html | 24 +- content/tag-developers/dojo-textarea-tag.html | 8 +- content/tag-developers/dojo-tree-tag.html | 32 +- content/tag-developers/dojo-treenode-tag.html | 16 +- content/tag-developers/doubleselect-tag.html | 31 +- content/tag-developers/else-tag.html | 27 +- content/tag-developers/elseif-tag.html | 27 +- content/tag-developers/fielderror-tag.html | 52 +- content/tag-developers/file-tag.html | 17 +- content/tag-developers/form-tag.html | 46 +- content/tag-developers/form-tags.html | 382 +++++- content/tag-developers/generator-tag.html | 87 +- content/tag-developers/head-tag.html | 20 +- content/tag-developers/hidden-tag.html | 24 +- content/tag-developers/i18n-tag.html | 24 +- content/tag-developers/if-tag.html | 12 +- content/tag-developers/include-tag.html | 44 +- .../tag-developers/inputtransferselect-tag.html | 43 +- content/tag-developers/iterator-tag.html | 178 ++- content/tag-developers/label-tag.html | 27 +- content/tag-developers/merge-tag.html | 89 +- content/tag-developers/optgroup-tag.html | 40 +- .../tag-developers/optiontransferselect-tag.html | 73 +- content/tag-developers/param-tag.html | 71 +- content/tag-developers/password-tag.html | 27 +- content/tag-developers/property-tag.html | 36 +- content/tag-developers/push-tag.html | 94 +- content/tag-developers/radio-tag.html | 47 +- content/tag-developers/reset-tag.html | 32 +- content/tag-developers/select-tag.html | 55 +- content/tag-developers/set-tag.html | 39 +- content/tag-developers/sort-tag.html | 41 +- content/tag-developers/submit-tag.html | 16 +- content/tag-developers/subset-tag.html | 115 +- content/tag-developers/text-tag.html | 54 +- content/tag-developers/textarea-tag.html | 16 +- content/tag-developers/textfield-tag.html | 24 +- content/tag-developers/token-tag.html | 21 +- content/tag-developers/updownselect-tag.html | 56 +- content/tag-developers/url-tag.html | 51 +- 122 files changed, 6701 insertions(+), 1425 deletions(-) diff --git a/content/core-developers/action-mapper.html b/content/core-developers/action-mapper.html index e47e7b0..3caf2a7 100644 --- a/content/core-developers/action-mapper.html +++ b/content/core-developers/action-mapper.html @@ -430,14 +430,52 @@

####PrefixBasedActionMapper####

-
{snippet:id=description|javadoc=true|url=org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper}
-
+
 <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>
+ &lt;constant name="struts.mapper.class" value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper"/&gt;
+ &lt;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"/&gt;
+ </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>
+
+

PrefixBasedActionProxyFactory

-
{snippet:id=description|javadoc=true|url=org.apache.struts2.factory.PrefixBasedActionProxyFactory}
-
+
 <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>
+ Add below entry to struts.xml to enable the factory:
+ </p>
+
+ <pre>
+ &lt;constant name="struts.actionProxyFactory" value="prefix"/&gt;
+ </pre>
+
+ <p>
+ The factory will use the same set of patterns as defined with:
+ </p>
+
+ <pre>
+ &lt;constant name="struts.mapper.prefixMapping" value="..."/&gt;
+ </pre>
+

####ActionMapper and ActionMapping objects####

diff --git a/content/core-developers/after-annotation.html b/content/core-developers/after-annotation.html index 7ff3ee4..ee4bf32 100644 --- a/content/core-developers/after-annotation.html +++ b/content/core-developers/after-annotation.html @@ -131,26 +131,56 @@

####After Annotation####

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.After}
-
+
 Marks a action method that needs to be called after the main action method and the result was
+ executed. Return value is ignored.
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.After}
-
+
 The After annotation can be applied at method level.
+
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.After}
-
+
 <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>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.interceptor.annotations.After}
-
+

+```java
+ public class SampleAction extends ActionSupport {
+
+  &#64;After
+  public void isValid() throws ValidationException {
+    // validate model object, throw exception if failed
+  }
+
+  public String execute() {
+     // perform action
+     return SUCCESS;
+  }
+ }
+```
+
+
diff --git a/content/core-developers/alias-interceptor.html b/content/core-developers/alias-interceptor.html index 0824ccf..4a96cd4 100644 --- a/content/core-developers/alias-interceptor.html +++ b/content/core-developers/alias-interceptor.html @@ -129,26 +129,55 @@ Edit on GitHub

Alias Interceptor

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.AliasInterceptor}
-
+

+ The aim of this Interceptor is to alias a named parameter to a different named parameter. By acting as the glue
+ between actions sharing similar parameters (but with different names), it can help greatly with action chaining.
+
+ <p>Action's alias expressions should be in the form of  <code>#{ "name1" : "alias1", "name2" : "alias2" }</code>.
+ This means that assuming an action (or something else in the stack) has a value for the expression named <i>name1</i> and the
+ action this interceptor is applied to has a setter named <i>alias1</i>, <i>alias1</i> will be set with the value from
+ <i>name1</i>.
+ </p>
+
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.AliasInterceptor}
-
+

+ <ul>
+
+ <li>aliasesKey (optional) - the name of the action parameter to look for the alias map (by default this is
+ <i>aliases</i>).</li>
+
+ </ul>
+
+

#####Extending the Interceptor#####

-
{snippet:id=extending|javadoc=true|url=com.opensymphony.xwork2.interceptor.AliasInterceptor}
-
+

+ This interceptor does not have any known extension points.
+
+

#####Examples#####

-
{snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.xwork2.interceptor.AliasInterceptor}
-
+

+```xml
+ &lt;action name="someAction" class="com.examples.SomeAction"&gt;
+     &lt;!-- The value for the foo parameter will be applied as if it were named bar --&gt;
+     &lt;param name="aliases"&gt;#{ 'foo' : 'bar' }&lt;/param&gt;
+
+     &lt;interceptor-ref name="alias"/&gt;
+     &lt;interceptor-ref name="basicStack"/&gt;
+     &lt;result name="success"&gt;good_result.ftl&lt;/result&gt;
+ &lt;/action&gt;
+```
+
+
diff --git a/content/core-developers/annotation-workflow-interceptor.html b/content/core-developers/annotation-workflow-interceptor.html index b66adb1..fa55ea4 100644 --- a/content/core-developers/annotation-workflow-interceptor.html +++ b/content/core-developers/annotation-workflow-interceptor.html @@ -129,14 +129,61 @@ Edit on GitHub

AnnotationWorkflowInterceptor

-
{snippet:id=javadoc|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.AnnotationWorkflowInterceptor}
-
+
 <p>Invokes any annotated methods on the action. Specifically, it supports the following
+ annotations:</p>
+ <ul>
+ <li> &#64;{@link Before} - will be invoked before the action method. If the returned value is not null, it is
+ returned as the action result code</li>
+ <li> &#64;{@link BeforeResult} - will be invoked after the action method but before the result execution</li>
+ <li> &#64;{@link After} - will be invoked after the action method and result execution</li>
+ </ul>
+
+ <p>There can be multiple methods marked with the same annotations, but the order of their execution
+ is not guaranteed. However, the annotated methods on the superclass chain are guaranteed to be invoked before the
+ annotated method in the current class in the case of a {@link Before} annotations and after, if the annotations is
+ {@link After}.</p>
+

#####Examples#####

-
{snippet:id=javacode|javadoc=true|lang=java|url=com.opensymphony.xwork2.interceptor.annotations.AnnotationWorkflowInterceptor}
-
+

+```java
+  public class BaseAnnotatedAction {
+  	protected String log = "";
+
+  	&#64;Before
+  	public String baseBefore() {
+  		log = log + "baseBefore-";
+  		return null;
+  	}
+  }
+
+  public class AnnotatedAction extends BaseAnnotatedAction {
+  	&#64;Before
+  	public String before() {
+  		log = log + "before";
+  		return null;
+  	}
+
+  	public String execute() {
+  		log = log + "-execute";
+  		return Action.SUCCESS;
+  	}
+
+  	&#64;BeforeResult
+  	public void beforeResult() throws Exception {
+  		log = log +"-beforeResult";
+  	}
+
+  	&#64;After
+  	public void after() {
+  		log = log + "-after";
+  	}
+  }
+```
+
+

Configure a stack in struts.xml that replaces the PrepareInterceptor with the AnnotationWorkflowInterceptor:

@@ -163,8 +210,9 @@
-
{snippet:id=example|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.AnnotationWorkflowInterceptor}
-
+
 <p>With the interceptor applied and the action executed on <code>AnnotatedAction</code> the log
+ instance variable will contain <code>baseBefore-before-execute-beforeResult-after</code>.</p>
+
diff --git a/content/core-developers/basic-validation.html b/content/core-developers/basic-validation.html index f03bacc..9c97958 100644 --- a/content/core-developers/basic-validation.html +++ b/content/core-developers/basic-validation.html @@ -135,16 +135,24 @@

Create the input form.

-
{snippet:id=basicValidation|javadoc=false|lang=xml|url=struts2/apps/showcase/src/main/webapp/WEB-INF/validation/quiz-basic.jsp}
-
+

+```xml
+START SNIPPET: basicValidation not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/apps/showcase/src/main/webapp/WEB-INF/validation/quiz-basic/jsp.java;hb=HEAD
+```
+
+

#####Step 2#####

Create the Action class.

-
{snippet:id=quizAction|javadoc=false|lang=java|url=struts2/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/QuizAction.java}
-
+

+```java
+START SNIPPET: quizAction not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/QuizAction/java.java;hb=HEAD
+```
+
+

#####Step 3#####

@@ -166,8 +174,12 @@

.

-
{snippet:id=quizValidators|javadoc=false|lang=xml|url=struts2/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/QuizAction-validation.xml}
-
+

+```xml
+START SNIPPET: quizValidators not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/QuizAction-validation/xml.java;hb=HEAD
+```
+
+

#####Step 4#####

diff --git a/content/core-developers/before-annotation.html b/content/core-developers/before-annotation.html index 110afef..2f4110e 100644 --- a/content/core-developers/before-annotation.html +++ b/content/core-developers/before-annotation.html @@ -131,26 +131,55 @@

####Before Annotation####

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.Before}
-
+
 Marks a action method that needs to be executed before the main action method.
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.Before}
-
+
 The Before annotation can be applied at method level.
+
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.Before}
-
+
 <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>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.interceptor.annotations.Before}
-
+

+```java
+ public class SampleAction extends ActionSupport {
+
+  &#64;Before
+  public void isAuthorized() throws AuthenticationException {
+    // authorize request, throw exception if failed
+  }
+
+  public String execute() {
+     // perform secure action
+     return SUCCESS;
+  }
+ }
+```
+
+
diff --git a/content/core-developers/before-result-annotation.html b/content/core-developers/before-result-annotation.html index 88cca21..861efb2 100644 --- a/content/core-developers/before-result-annotation.html +++ b/content/core-developers/before-result-annotation.html @@ -131,26 +131,55 @@

####BeforeResult Annotation####

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.BeforeResult}
-
+
 Marks a action method that needs to be executed before the result. Return value is ignored.
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.BeforeResult}
-
+
 The BeforeResult annotation can be applied at method level.
+
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.BeforeResult}
-
+
 <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>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.interceptor.annotations.BeforeResult}
-
+

+```java
+ public class SampleAction extends ActionSupport {
+
+  &#64;BeforeResult
+  public void isValid() throws ValidationException {
+    // validate model object, throw exception if failed
+  }
+
+  public String execute() {
+     // perform action
+     return SUCCESS;
+  }
+ }
+```
+
+
diff --git a/content/core-developers/checkbox-interceptor.html b/content/core-developers/checkbox-interceptor.html index dd85bed..0a65554 100644 --- a/content/core-developers/checkbox-interceptor.html +++ b/content/core-developers/checkbox-interceptor.html @@ -168,14 +168,16 @@

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=org.apache.struts2.interceptor.CheckboxInterceptor}
-
+
 <ul>
+ <li>setUncheckedValue - The default value of an unchecked box can be overridden by setting the 'uncheckedValue' property.</li>
+ </ul>
+

#####Extending the Interceptor#####

-
{snippet:id=extending|javadoc=true|url=org.apache.struts2.interceptor.CheckboxInterceptor}
-
+

+
diff --git a/content/core-developers/client-validation.html b/content/core-developers/client-validation.html index 4f56cc3..3b5411f 100644 --- a/content/core-developers/client-validation.html +++ b/content/core-developers/client-validation.html @@ -149,8 +149,12 @@

Create the form.

-
{snippet:id=clientValidation|lang=xml|javadoc=false|url=struts2/apps/showcase/src/main/webapp/WEB-INF/validation/quiz-client.jsp}
-
+

+```xml
+START SNIPPET: clientValidation not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/apps/showcase/src/main/webapp/WEB-INF/validation/quiz-client/jsp.java;hb=HEAD
+```
+
+

(information) This case uses the default xhtml theme, so the

@@ -163,8 +167,12 @@

Create the Action class.

-
{snippet:id=quizAction|javadoc=false|lang=java|url=struts2/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/QuizAction.java}
-
+

+```java
+START SNIPPET: quizAction not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/QuizAction/java.java;hb=HEAD
+```
+
+

Step 3

@@ -176,8 +184,12 @@

to configure the validators to be used.

-
{snippet:id=quizValidators|javadoc=false|lang=xml|url=struts2/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/QuizAction-validation.xml}
-
+

+```xml
+START SNIPPET: quizValidators not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/QuizAction-validation/xml.java;hb=HEAD
+```
+
+

Action and Namespace

diff --git a/content/core-developers/conversion-annotation.html b/content/core-developers/conversion-annotation.html index 64529e6..02f6237 100644 --- a/content/core-developers/conversion-annotation.html +++ b/content/core-developers/conversion-annotation.html @@ -129,26 +129,66 @@ Edit on GitHub

Conversion Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.conversion.annotations.Conversion}
-
+
 A marker annotation for type conversions at Type level.
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.conversion.annotations.Conversion}
-
+
 The Conversion annotation must be applied at Type level.
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.conversion.annotations.Conversion}
-
+
 <table summary="">
+ <thead>
+ <tr>
+ <th>Parameter</th>
+ <th>Required</th>
+ <th>Default</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>conversion</td>
+ <td>no</td>
+ <td>&nbsp;</td>
+ <td>used for Type Conversions applied at Type level.</td>
+ </tr>
+ </tbody>
+ </table>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.conversion.annotations.Conversion}
-
+

+```java
+ &#64;Conversion(
+     conversions = {
+          // key must be the name of a property for which converter should be used
+          &#64;TypeConversion(key = "date", converter = "org.demo.converter.DateConverter")
+     }
+ )
+ public class ConversionAction implements Action {
+
+     private Date date;
+
+     public setDate(Date date) {
+         this.date = date;
+     }
+
+     public Date getDate() {
+         return date;
+     }
+
+ }
+
+```
+
+

Check also TypeConversion Annotation for more examples!

diff --git a/content/core-developers/conversion-error-field-validator-annotation.html b/content/core-developers/conversion-error-field-validator-annotation.html index 7e28dac..237eb25 100644 --- a/content/core-developers/conversion-error-field-validator-annotation.html +++ b/content/core-developers/conversion-error-field-validator-annotation.html @@ -129,26 +129,74 @@ Edit on GitHub

ConversionErrorFieldValidator Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.ConversionErrorFieldValidator}
-
+
 This validator checks if there are any conversion errors for a field and applies them if they exist.
+ See <a href="https://struts.apache.org/docs/type-conversion.html#TypeConversion-TypeConversionErrorHandling">Type Conversion Error Handling</a> for details.
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.ConversionErrorFieldValidator}
-
+
 <p>The ConversionErrorFieldValidator annotation must be applied at method level.</p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.ConversionErrorFieldValidator}
-
+
 <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'>message</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>field error message</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>key</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>messageParams</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>Additional params to be used to customize message - will be evaluated against the Value Stack</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>fieldName</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>shortCircuit</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>false</td>
+ <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>type</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>ValidatorType.FIELD</td>
+ <td class='confluenceTd'>Enum value from ValidatorType. Either FIELD or SIMPLE can be used here.</td>
+ </tr>
+ </table>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.ConversionErrorFieldValidator}
-
+

+```java
+ &#64;ConversionErrorFieldValidator(message = "Default message", key = "i18n.key", shortCircuit = true)
+```
+
+
diff --git a/content/core-developers/conversion-error-interceptor.html b/content/core-developers/conversion-error-interceptor.html index 588d127..5a74d73 100644 --- a/content/core-developers/conversion-error-interceptor.html +++ b/content/core-developers/conversion-error-interceptor.html @@ -133,32 +133,68 @@

From the Javadocs of the XWork 2 interceptor:

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor}
-
+
 ConversionErrorInterceptor adds conversion errors from the ActionContext to the Action's field errors.
+
+ <p>
+ This interceptor adds any error found in the {@link ActionContext}'s conversionErrors map as a field error (provided
+ that the action implements {@link ValidationAware}). In addition, any field that contains a validation error has its
+ original value saved such that any subsequent requests for that value return the original value rather than the value
+ in the action. This is important because if the value "abc" is submitted and can't be converted to an int, we want to
+ display the original string ("abc") again rather than the int value (likely 0, which would make very little sense to
+ the user).
+ </p>
+ 
+ <p>
+ <b>Note:</b> Since 2.5.2, this interceptor extends {@link MethodFilterInterceptor}, therefore being
+ able to deal with excludeMethods / includeMethods parameters. See [Workflow Interceptor]
+ (class {@link DefaultWorkflowInterceptor}) for documentation and examples on how to use this feature.
+ </p>
+ 
+

From the Javadocs of the Struts 2 interceptor:

-
{snippet:id=description|javadoc=true|url=org.apache.struts2.interceptor.StrutsConversionErrorInterceptor}
-
+
 <p>
+ This interceptor extends {@link ConversionErrorInterceptor} but only adds conversion errors from the ActionContext to
+ the field errors of the action if the field value is not null, "", or {""} (a size 1 String array with only an empty
+ String). See {@link ConversionErrorInterceptor} for more information, as well as the Type Conversion documentation.
+ </p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=org.apache.struts2.interceptor.StrutsConversionErrorInterceptor}
-
+

+ <ul>
+
+ <li>None</li>
+
+ </ul>
+
+

#####Extending the Interceptor#####

-
{snippet:id=extending|javadoc=true|url=org.apache.struts2.interceptor.StrutsConversionErrorInterceptor}
-
+
 <p>
+ There are no known extension points for this interceptor.
+ </p>
+

#####Examples#####

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.interceptor.StrutsConversionErrorInterceptor}
-
+

+```xml
+ &lt;action name="someAction" class="com.examples.SomeAction"&gt;
+     &lt;interceptor-ref name="params"/&gt;
+     &lt;interceptor-ref name="conversionError"/&gt;
+     &lt;result name="success"&gt;good_result.ftl&lt;/result&gt;
+ &lt;/action&gt;
+```
+
+
diff --git a/content/core-developers/cookie-interceptor.html b/content/core-developers/cookie-interceptor.html index 1a6e400..3ed024b 100644 --- a/content/core-developers/cookie-interceptor.html +++ b/content/core-developers/cookie-interceptor.html @@ -129,26 +129,143 @@ Edit on GitHub

Cookie Interceptor

-
{snippet:id=description|javadoc=true|url=org.apache.struts2.interceptor.CookieInterceptor}
-
+

+ <p>
+ The aim of this interceptor is to set values in the stack/action based on cookie name/value
+ of interest.
+ </p>
+
+ <p>
+ If an asterisk is present in cookiesName parameter, it will be assume that
+ all cookies name are to be injected into struts' action, even though
+ cookiesName is comma-separated by other values, e.g. (cookie1,*,cookie2).
+ </p>
+
+ <p>
+ If cookiesName is left empty it will assume that no cookie will be injected
+ into Struts' action.
+ </p>
+
+ <p>
+ If an asterisk is present in cookiesValue parameter, it will assume that all
+ cookies name irrespective of its value will be injected into Struts' action so
+ long as the cookie name matches those specified in cookiesName parameter.
+ </p>
+
+ <p>
+ If cookiesValue is left empty it will assume that all cookie that match the cookieName
+ parameter will be injected into Struts' action.
+ </p>
+
+ <p>
+ The action could implement {@link CookiesAware} in order to have a {@link Map}
+ of filtered cookies set into it.
+ </p>
+
+

Parameters

-
{snippet:id=parameters|javadoc=true|url=org.apache.struts2.interceptor.CookieInterceptor}
-
+

+ <ul>
+      <li>cookiesName (mandatory) - Name of cookies to be injected into the action. If more
+                                                                 than one cookie name is desired it could be comma-separated.
+                                                                 If all cookies name is desired, it could simply be *, an asterik.
+                                                                 When many cookies name are comma-separated either of the cookie
+                                                        that match the name in the comma-separated list will be qualified.</li>
+     <li>cookiesValue (mandatory) - Value of cookies that if its name matches cookieName attribute
+                                                         and its value matched this, will be injected into Struts'
+                                                         action. If more than one cookie name is desired it could be
+                                                         comma-separated. If left empty, it will assume any value would
+                                                         be ok. If more than one value is specified (comma-separated)
+                                                         it will assume a match if either value is matched.</li>
+     <li>acceptCookieNames (optional) - Pattern used to check if name of cookie matches the provided patter, to </li>
+ </ul>
+
+

Extending the Interceptor

-
{snippet:id=extending|javadoc=true|url=org.apache.struts2.interceptor.CookieInterceptor}
-
+

+ <ul>
+     <li>
+         populateCookieValueIntoStack - this method will decide if this cookie value is qualified
+         to be populated into the value stack (hence into the action itself)
+     </li>
+     <li>
+         injectIntoCookiesAwareAction - this method will inject selected cookies (as a java.util.Map)
+         into action that implements &#x7b;@link CookiesAware&#x7d;.
+     </li>
+ </ul>
+
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.interceptor.CookieInterceptor}
-
+

+```xml
+
+ &lt;!--
+   This example will inject cookies named either 'cookie1' or 'cookie2' whose
+   value could be either 'cookie1value' or 'cookie2value' into Struts' action.
+ --&gt;
+ &lt;action ... &gt;
+    &lt;interceptor-ref name="cookie"&gt;
+        &lt;param name="cookiesName"&gt;cookie1, cookie2&lt;/param&gt;
+        &lt;param name="cookiesValue"&gt;cookie1value, cookie2value&lt;/param&gt;
+    &lt;/interceptor-ref&gt;
+    ....
+ &lt;/action&gt;
+
+
+ &lt;!--
+      This example will inject cookies named either 'cookie1' or 'cookie2'
+     regardless of their value into Struts' action.
+ --&gt;
+ &lt;action ... &gt;
+   &lt;interceptor-ref name="cookie"&gt;
+      &lt;param name="cookiesName"&gt;cookie1, cookie2&lt;/param&gt;
+      &lt;param name="cookiesValue"&gt;*&lt;/param&gt;
+   &lt;interceptor-ref&gt;
+   ...
+ &lt;/action&gt;
+
+
+ &lt;!--
+      This example will inject cookies named either 'cookie1' with value
+      'cookie1value' or 'cookie2' with value 'cookie2value' into Struts'
+      action.
+ --&gt;
+ &lt;action ... &gt;
+   &lt;interceptor-ref name="cookie"&gt;
+      &lt;param name="cookiesName"&gt;cookie1&lt;/param&gt;
+      &lt;param name="cookiesValue"&gt;cookie1value&lt;/param&gt;
+   &lt;/interceptor-ref&gt;
+   &lt;interceptor-ref name="cookie"&gt;
+      &lt;param name="cookiesName"&lt;cookie2&lt;/param&gt;
+     &lt;param name="cookiesValue"&gt;cookie2value&lt;/param&gt;
+   &lt;/interceptor-ref&gt;
+   ....
+ &lt;/action&gt;
+
+ &lt;!--
+    This example will inject any cookies regardless of its value into
+    Struts' action.
+  --&gt;
+ &lt;action ... &gt;
+   &lt;interceptor-ref name="cookie"&gt;
+      &lt;param name="cookiesName"&gt;*&lt;/param&gt;
+      &lt;param name="cookiesValue"&gt;*&lt;/param&gt;
+   &lt;/interceptor-ref&gt;
+    ...
+ &lt;/action&gt;
+
+```
+
+
diff --git a/content/core-developers/cookie-provider-interceptor.html b/content/core-developers/cookie-provider-interceptor.html index b4824fb..eea5059 100644 --- a/content/core-developers/cookie-provider-interceptor.html +++ b/content/core-developers/cookie-provider-interceptor.html @@ -129,26 +129,44 @@ Edit on GitHub

CookieProvider Interceptor

-
{snippet:id=description|javadoc=true|url=org.apache.struts2.interceptor.CookieProviderInterceptor}
-
+
 Allows actions to send cookies to client, action must implement {@link CookieProvider}
+ You must reference this interceptor in your default stack or in action's stack, see example below.
+
+

Parameters

-
{snippet:id=parameters|javadoc=true|url=org.apache.struts2.interceptor.CookieProviderInterceptor}
-
+

+ none
+
+

Extending the Interceptor

-
{snippet:id=extending|javadoc=true|url=org.apache.struts2.interceptor.CookieProviderInterceptor}
-
+

+ <ul>
+     <li>addCookiesToResponse - this method applies cookie created by action to response</li>
+ </ul>
+
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.interceptor.CookieProviderInterceptor}
-
+

+```xml
+
+ &lt;action ... &gt;
+   &lt;interceptor-ref name="defaultStack"/&gt;
+   &lt;interceptor-ref name="cookieProvider"/&gt;
+   ...
+ &lt;/action&gt;
+
+```
+
+
diff --git a/content/core-developers/create-if-null-annotation.html b/content/core-developers/create-if-null-annotation.html index e1db105..4741392 100644 --- a/content/core-developers/create-if-null-annotation.html +++ b/content/core-developers/create-if-null-annotation.html @@ -129,26 +129,48 @@ Edit on GitHub

CreateIfNull Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.util.CreateIfNull}
-
+
 <p>Sets the CreateIfNull for type conversion.</p>
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.util.CreateIfNull}
-
+
 <p>The CreateIfNull annotation must be applied at field or method level.</p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.util.CreateIfNull}
-
+
 <table summary="">
+ <thead>
+ <tr>
+ <th>Parameter</th>
+ <th>Required</th>
+ <th>Default</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>value</td>
+ <td>no</td>
+ <td>false</td>
+ <td>The CreateIfNull property value.</td>
+ </tr>
+ </tbody>
+ </table>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.util.CreateIfNull}
-
+

+```java
+ &#64;CreateIfNull( value = true )
+ private List&lt;User&gt; users;
+```
+
+
diff --git a/content/core-developers/create-session-interceptor.html b/content/core-developers/create-session-interceptor.html index 042e2ca..f986c10 100644 --- a/content/core-developers/create-session-interceptor.html +++ b/content/core-developers/create-session-interceptor.html @@ -129,26 +129,53 @@ Edit on GitHub

Create Session Interceptor

-
{snippet:id=description|javadoc=true|url=org.apache.struts2.interceptor.CreateSessionInterceptor}
-
+

+ <p>
+ This interceptor creates the HttpSession if it doesn't exist, also SessionMap is recreated and put in ServletActionContext.
+ </p>
+
+ <p>
+ This is particular useful when using the &lt;@s.token&gt; tag in freemarker templates.
+ The tag <b>do</b> require that a HttpSession is already created since freemarker commits
+ the response to the client immediately.
+ </p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=org.apache.struts2.interceptor.CreateSessionInterceptor}
-
+

+ <ul>
+ <li>None</li>
+ </ul>
+
+

#####Extending the Interceptor#####

-
{snippet:id=extending|javadoc=true|url=org.apache.struts2.interceptor.CreateSessionInterceptor}
-
+

+ <ul>
+  <li>None</li>
+ </ul>
+
+

#####Examples#####

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.interceptor.CreateSessionInterceptor}
-
+

+```xml
+
+ &lt;action name="someAction" class="com.examples.SomeAction"&gt;
+     &lt;interceptor-ref name="createSession"/&gt;
+     &lt;interceptor-ref name="defaultStack"/&gt;
+     &lt;result name="input"&gt;input_with_token_tag.ftl&lt;/result&gt;
+ &lt;/action&gt;
+
+```
+
+
diff --git a/content/core-developers/custom-validator-annotation.html b/content/core-developers/custom-validator-annotation.html index 97f492b..2798e7f 100644 --- a/content/core-developers/custom-validator-annotation.html +++ b/content/core-developers/custom-validator-annotation.html @@ -129,26 +129,73 @@ Edit on GitHub

CustomValidator Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.CustomValidator}
-
+
 This annotation can be used for custom validators. Use the ValidationParameter annotation to supply additional params.
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.CustomValidator}
-
+
 <p>The annotation must be applied at method or type level.</p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.CustomValidator}
-
+
 <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'>message</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>field error message</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>key</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>messageParams</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>Additional params to be used to customize message - will be evaluated against the Value Stack</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>fieldName</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>shortCircuit</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>false</td>
+ <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>type</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>name of validator</td>
+ <td class='confluenceTd'>Simple string which identifies that validator among other</td>
+ </tr>
+ </table>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.CustomValidator}
-
+

+```java
+ &#64;CustomValidator(type ="customValidatorName", fieldName = "myField")
+```
+
+

#####Adding Parameters#####

diff --git a/content/core-developers/date-range-field-validator-annotation.html b/content/core-developers/date-range-field-validator-annotation.html index bb68963..afd03fa 100644 --- a/content/core-developers/date-range-field-validator-annotation.html +++ b/content/core-developers/date-range-field-validator-annotation.html @@ -129,26 +129,111 @@ Edit on GitHub

DateRangeFieldValidator Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.DateRangeFieldValidator}
-
+
 This validator checks that a date field has a value within a specified range.
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.DateRangeFieldValidator}
-
+
 <p>The annotation must be applied at method level.</p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.DateRangeFieldValidator}
-
+
 <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'>message</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>field error message</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>key</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>messageParams</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>Additional params to be used to customize message - will be evaluated against the Value Stack</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>fieldName</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>shortCircuit</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>false</td>
+ <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>type</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>ValidatorType.FIELD</td>
+ <td class='confluenceTd'>Enum value from ValidatorType. Either FIELD or SIMPLE can be used here.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> min </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'> Date property.  The minimum the date must be. </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>minExpression</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>OGNL expression used to obtain the minimum the date must be.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> max </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'> Date property.  The maximum date can be. </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>maxExpression</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>OGNL expression used to obtain the maximum date can be.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>maxExpression</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>OGNL expression used to obtain the maximum date can be.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>dateFormat</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <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>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.DateRangeFieldValidator}
-
+

+```java
+ &#64;DateRangeFieldValidator(message = "Default message", key = "i18n.key", shortCircuit = true, min = "2005/01/01", max = "2005/12/31")
+```
+
+
diff --git a/content/core-developers/debugging-interceptor.html b/content/core-developers/debugging-interceptor.html index 07a1b95..1f7758d 100644 --- a/content/core-developers/debugging-interceptor.html +++ b/content/core-developers/debugging-interceptor.html @@ -129,24 +129,42 @@ Edit on GitHub

DebuggingInterceptor

-
{snippet:id=description|javadoc=true|url=org.apache.struts2.interceptor.debugging.DebuggingInterceptor}
-
+
 <p>
+ Provides several different debugging screens to provide insight into the
+ data behind the page.
+ </p>
+
-
{snippet:id=remarks|javadoc=true|url=org.apache.struts2.interceptor.debugging.DebuggingInterceptor}
-
+
 This interceptor only is activated when devMode is enabled in
+ struts.properties. The 'debug' parameter is removed from the parameter list
+ before the action is executed. All operations occur before the natural
+ Result has a chance to execute.
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=org.apache.struts2.interceptor.debugging.DebuggingInterceptor}
-
+
 <ul>
+ <li> <code>xml</code> - Dumps the parameters, context, session, and value
+ stack as an XML document.</li>
+ <li> <code>console</code> - Shows a popup 'OGNL Console' that allows the
+ user to test OGNL expressions against the value stack. The XML data from
+ the 'xml' mode is inserted at the top of the page.</li>
+ <li> <code>command</code> - Tests an OGNL expression and returns the
+ string result. Only used by the OGNL console.</li>
+ <li><code>browser</code> Shows field values of an object specified in the 
+ <code>object</code> parameter (#context by default). When the <code>object</code>
+ parameters is set, the '#' character needs to be escaped to '%23'. Like
+ debug=browser&amp;object=%23parameters</li>
+ </ul>
+

#####Example#####

-
{snippet:id=example|javadoc=true|url=org.apache.struts2.interceptor.debugging.DebuggingInterceptor}
-
+
  http://localhost:8080/Welcome.action?debug=xml
+
diff --git a/content/core-developers/default-workflow-interceptor.html b/content/core-developers/default-workflow-interceptor.html index b7c3e92..b502c87 100644 --- a/content/core-developers/default-workflow-interceptor.html +++ b/content/core-developers/default-workflow-interceptor.html @@ -129,30 +129,115 @@ Edit on GitHub

Default Workflow Interceptor

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor}
-
+
 <p>
+ An interceptor that makes sure there are not validation, conversion or action errors before allowing the interceptor chain to continue. 
+ If a single FieldError or ActionError (including the ones replicated by the Message Store Interceptor in a redirection) is found, the INPUT result will be triggered.
+ <b>This interceptor does not perform any validation</b>.
+ </p>
+
+ <p>
+ This interceptor does nothing if the name of the method being invoked is specified in the <b>excludeMethods</b>
+ parameter. <b>excludeMethods</b> accepts a comma-delimited list of method names. For example, requests to
+ <b>foo!input.action</b> and <b>foo!back.action</b> will be skipped by this interceptor if you set the
+ <b>excludeMethods</b> parameter to "input, back".
+ </p>
+
+ <p>
+ <b>Note:</b> As this method extends off MethodFilterInterceptor, it is capable of
+ deciding if it is applicable only to selective methods in the action class. This is done by adding param tags
+ for the interceptor element, naming either a list of excluded method names and/or a list of included method
+ names, whereby includeMethods overrides excludedMethods. A single * sign is interpreted as wildcard matching
+ all methods for both parameters.
+ See {@link MethodFilterInterceptor} for more info.
+ </p>
+
+ <p>
+ This interceptor also supports the following interfaces which can implemented by actions:
+ </p>
+
+ <ul>
+     <li>ValidationAware - implemented by ActionSupport class</li>
+     <li>ValidationWorkflowAware - allows changing result name programmatically</li>
+     <li>ValidationErrorAware - notifies action about errors and also allow change result name</li>
+ </ul>
+
+ <p>
+ You can also use InputConfig annotation to change result name returned when validation errors occurred.
+ </p>
+
+
-
{snippet:id=javadocDefaultWorkflowInterceptor|javadoc=true|url=com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil}
-
+
 
+ <b>In DefaultWorkflowInterceptor</b>
+ <p>applies only when action implements {@link com.opensymphony.xwork2.Validateable}</p>
+ <ol>
+    <li>if the action class have validate{MethodName}(), it will be invoked</li>
+    <li>else if the action class have validateDo{MethodName}(), it will be invoked</li>
+    <li>no matter if 1] or 2] is performed, if alwaysInvokeValidate property of the interceptor is "true" (which is by default "true"), validate() will be invoked.</li>
+ </ol>
+ 
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor}
-
+
 <ul>
+ <li>inputResultName - Default to "input". Determine the result name to be returned when
+ an action / field error is found.</li>
+ </ul>
+

#####Extending the Interceptor#####

-
{snippet:id=extending|javadoc=true|url=com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor}
-
+

+ <p>There are no known extension points for this interceptor.</p>
+
+

#####Examples#####

-
{snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor}
-
+

+```xml
+
+ &lt;action name="someAction" class="com.examples.SomeAction"&gt;
+     &lt;interceptor-ref name="params"/&gt;
+     &lt;interceptor-ref name="validation"/&gt;
+     &lt;interceptor-ref name="workflow"/&gt;
+     &lt;result name="success"&gt;good_result.ftl&lt;/result&gt;
+ &lt;/action&gt;
+
+ &lt;-- In this case myMethod as well as mySecondMethod of the action class
+        will not pass through the workflow process --&gt;
+ &lt;action name="someAction" class="com.examples.SomeAction"&gt;
+     &lt;interceptor-ref name="params"/&gt;
+     &lt;interceptor-ref name="validation"/&gt;
+     &lt;interceptor-ref name="workflow"&gt;
+         &lt;param name="excludeMethods"&gt;myMethod,mySecondMethod&lt;/param&gt;
+     &lt;/interceptor-ref name="workflow"&gt;
+     &lt;result name="success"&gt;good_result.ftl&lt;/result&gt;
+ &lt;/action&gt;
+
+ &lt;-- In this case, the result named "error" will be used when
+        an action / field error is found --&gt;
+ &lt;-- The Interceptor will only be applied for myWorkflowMethod method of action
+        classes, since this is the only included method while any others are excluded --&gt;
+ &lt;action name="someAction" class="com.examples.SomeAction"&gt;
+     &lt;interceptor-ref name="params"/&gt;
+     &lt;interceptor-ref name="validation"/&gt;
+     &lt;interceptor-ref name="workflow"&gt;
+        &lt;param name="inputResultName"&gt;error&lt;/param&gt;
+         &lt;param name="excludeMethods"&gt;*&lt;/param&gt;
+         &lt;param name="includeMethods"&gt;myWorkflowMethod&lt;/param&gt;
+     &lt;/interceptor-ref&gt;
+     &lt;result name="success"&gt;good_result.ftl&lt;/result&gt;
+ &lt;/action&gt;
+
+```
+
+
diff --git a/content/core-developers/double-range-field-validator-annotation.html b/content/core-developers/double-range-field-validator-annotation.html index a3fad2d..ec4e125 100644 --- a/content/core-developers/double-range-field-validator-annotation.html +++ b/content/core-developers/double-range-field-validator-annotation.html @@ -129,26 +129,126 @@ Edit on GitHub

DoubleRangeFieldValidator Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.DoubleRangeFieldValidator}
-
+
 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.
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.DoubleRangeFieldValidator}
-
+
 <p>The annotation must be applied at method level.</p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.DoubleRangeFieldValidator}
-
+
 <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'>message</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>field error message</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>key</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>messageParams</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>Additional params to be used to customize message - will be evaluated against the Value Stack</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>fieldName</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>shortCircuit</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>false</td>
+ <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>type</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>ValidatorType.FIELD</td>
+ <td class='confluenceTd'>Enum value from ValidatorType. Either FIELD or SIMPLE can be used here.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> minInclusive </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'> Double property.  The inclusive minimum the number must be. </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>minInclusiveExpression</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>OGNL expression used to obtain the inclusive minimum the number must be. </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> maxInclusive </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'> Double property.  The inclusive maximum number can be. </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> maxInclusiveExpression </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>OGNL expression used to obtain the inclusive maximum number can be. </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> minExclusive </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'> Double property.  The exclusive minimum the number must be. </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> minExclusiveExpression </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>OGNL expression used to obtain the exclusive minimum the number must be. </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> maxExclusive </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'> Double property.  The exclusive maximum number can be. </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> maxExclusiveExpression </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>OGNL expression used to obtain the exclusive maximum number can be. </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>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.DoubleRangeFieldValidator}
-
+

+```java
+ &#64;DoubleRangeFieldValidator(message = "Default message", key = "i18n.key", shortCircuit = true, minInclusive = "0.123", maxInclusive = "99.987")
+```
+
+
diff --git a/content/core-developers/element-annotation.html b/content/core-developers/element-annotation.html index 485a7ee..cfd7124 100644 --- a/content/core-developers/element-annotation.html +++ b/content/core-developers/element-annotation.html @@ -129,20 +129,37 @@ Edit on GitHub

Element Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.util.Element}
-
+
 <p>Sets the Element for type conversion.</p>
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.util.Element}
-
+
 <p>The Element annotation must be applied at field or method level.</p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.util.Element}
-
+
 <table summary="">
+ <thead>
+ <tr>
+ <th>Parameter</th>
+ <th>Required</th>
+ <th>Default</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>value</td>
+ <td>no</td>
+ <td>java.lang.Object.class</td>
+ <td>The element property value.</td>
+ </tr>
+ </tbody>
+ </table>
+

#####Examples#####

diff --git a/content/core-developers/email-validator-annotation.html b/content/core-developers/email-validator-annotation.html index 021fc48..c8176bc 100644 --- a/content/core-developers/email-validator-annotation.html +++ b/content/core-developers/email-validator-annotation.html @@ -129,26 +129,73 @@ Edit on GitHub

EmailValidator Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.EmailValidator}
-
+
 This validator checks that a field is a valid e-mail address if it contains a non-empty String.
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.EmailValidator}
-
+
 <p>The annotation must be applied at method level.</p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.EmailValidator}
-
+
 <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'>message</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>field error message</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>key</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>messageParams</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>Additional params to be used to customize message - will be evaluated against the Value Stack</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>fieldName</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>shortCircuit</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>false</td>
+ <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>type</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>ValidatorType.FIELD</td>
+ <td class='confluenceTd'>Enum value from ValidatorType. Either FIELD or SIMPLE can be used here.</td>
+ </tr>
+ </table>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.EmailValidator}
-
+

+```java
+ &#64;EmailValidator(message = "Default message", key = "i18n.key", shortCircuit = true)
+```
+
+
diff --git a/content/core-developers/exception-interceptor.html b/content/core-developers/exception-interceptor.html index 502ba8d..2a051b7 100644 --- a/content/core-developers/exception-interceptor.html +++ b/content/core-developers/exception-interceptor.html @@ -129,26 +129,81 @@ Edit on GitHub

#Exception Interceptor

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor}
-
+
 <p>
+ This interceptor forms the core functionality of the exception handling feature. Exception handling allows you to map
+ an exception to a result code, just as if the action returned a result code instead of throwing an unexpected
+ exception. When an exception is encountered, it is wrapped with an {@link ExceptionHolder} and pushed on the stack,
+ providing easy access to the exception from within your result.
+ </p>
+
+ <p>
+ <b>Note:</b> While you can configure exception mapping in your configuration file at any point, the configuration
+ will not have any effect if this interceptor is not in the interceptor stack for your actions. It is recommended that
+ you make this interceptor the first interceptor on the stack, ensuring that it has full access to catch any
+ exception, even those caused by other interceptors.
+ </p>
+
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor}
-
+

+ <ul>
+
+ <li>logEnabled (optional) - Should exceptions also be logged? (boolean true|false)</li>
+ 
+ <li>logLevel (optional) - what log level should we use (<code>trace, debug, info, warn, error, fatal</code>)? - defaut is <code>debug</code></li>
+ 
+ <li>logCategory (optional) - If provided we would use this category (eg. <code>com.mycompany.app</code>).
+ Default is to use <code>com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor</code>.</li>
+
+ </ul>
+
+ <p>
+ The parameters above enables us to log all thrown exceptions with stacktace in our own logfile,
+ and present a friendly webpage (with no stacktrace) to the end user.
+ </p>
+
+

#####Extending the Interceptor#####

-
{snippet:id=extending|javadoc=true|url=com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor}
-
+
 <p>
+ If you want to add custom handling for publishing the Exception, you may override
+ {@link #publishException(com.opensymphony.xwork2.ActionInvocation, ExceptionHolder)}. The default implementation
+ pushes the given ExceptionHolder on value stack. A custom implementation could add additional logging etc.
+ </p>
+

#####Examples#####

-
{snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor}
-
+

+```xml
+ &lt;xwork&gt;
+     &lt;package name="default" extends="xwork-default"&gt;
+         &lt;global-results&gt;
+             &lt;result name="error" type="freemarker"&gt;error.ftl&lt;/result&gt;
+         &lt;/global-results&gt;
+
+         &lt;global-exception-mappings&gt;
+             &lt;exception-mapping exception="java.lang.Exception" result="error"/&gt;
+         &lt;/global-exception-mappings&gt;
+
+         &lt;action name="test"&gt;
+             &lt;interceptor-ref name="exception"/&gt;
+             &lt;interceptor-ref name="basicStack"/&gt;
+             &lt;exception-mapping exception="com.acme.CustomException" result="custom_error"/&gt;
+             &lt;result name="custom_error"&gt;custom_error.ftl&lt;/result&gt;
+             &lt;result name="success" type="freemarker"&gt;test.ftl&lt;/result&gt;
+         &lt;/action&gt;
+     &lt;/package&gt;
+ &lt;/xwork&gt;
+```
+
+
diff --git a/content/core-developers/execute-and-wait-interceptor.html b/content/core-developers/execute-and-wait-interceptor.html index 27cdd61..13ec40c 100644 --- a/content/core-developers/execute-and-wait-interceptor.html +++ b/content/core-developers/execute-and-wait-interceptor.html @@ -129,26 +129,142 @@ Edit on GitHub

Execute and Wait Interceptor

-
{snippet:id=description|javadoc=true|url=org.apache.struts2.interceptor.ExecuteAndWaitInterceptor}
-
+
 <p>
+ The ExecuteAndWaitInterceptor is great for running long-lived actions in the background while showing the user a nice
+ progress meter. This also prevents the HTTP request from timing out when the action takes more than 5 or 10 minutes.
+ </p>
+
+ <p> Using this interceptor is pretty straight forward. Assuming that you are including struts-default.xml, this
+ interceptor is already configured but is not part of any of the default stacks. Because of the nature of this
+ interceptor, it must be the <b>last</b> interceptor in the stack.
+ </p>
+
+ <p> This interceptor works on a per-session basis. That means that the same action name (myLongRunningAction, in the
+ above example) cannot be run more than once at a time in a given session. On the initial request or any subsequent
+ requests (before the action has completed), the <b>wait</b> result will be returned. <b>The wait result is
+ responsible for issuing a subsequent request back to the action, giving the effect of a self-updating progress
+ meter</b>.
+ </p>
+
+ <p> If no "wait" result is found, Struts will automatically generate a wait result on the fly. This result is
+ written in FreeMarker and cannot run unless FreeMarker is installed. If you don't wish to deploy with FreeMarker, you
+ must provide your own wait result. This is generally a good thing to do anyway, as the default wait page is very
+ plain.
+ </p>
+
+ <p>Whenever the wait result is returned, the <b>action that is currently running in the background will be placed on
+ top of the stack</b>. This allows you to display progress data, such as a count, in the wait page. By making the wait
+ page automatically reload the request to the action (which will be short-circuited by the interceptor), you can give
+ the appearance of an automatic progress meter.
+ </p>
+
+ <p>This interceptor also supports using an initial wait delay. An initial delay is a time in milliseconds we let the
+ server wait before the wait page is shown to the user. During the wait this interceptor will wake every 100 millis
+ to check if the background process is done premature, thus if the job for some reason doesn't take to long the wait
+ page is not shown to the user.
+ <br> This is useful for e.g. search actions that have a wide span of execution time. Using a delay time of 2000
+ millis we ensure the user is presented fast search results immediately and for the slow results a wait page is used.
+ </p>
+
+ <p><b>Important</b>: Because the action will be running in a separate thread, you can't use ActionContext because it
+ is a ThreadLocal. This means if you need to access, for example, session data, you need to implement SessionAware
+ rather than calling ActionContext.getSession().
+ </p>
+
+ <p>The thread kicked off by this interceptor will be named in the form <b><u>actionName</u>BackgroundProcess</b>.
+ For example, the <i>search</i> action would run as a thread named <i>searchBackgroundProcess</i>.
+ </p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=org.apache.struts2.interceptor.ExecuteAndWaitInterceptor}
-
+

+ <ul>
+
+ <li>threadPriority (optional) - the priority to assign the thread. Default is <code>Thread.NORM_PRIORITY</code>.</li>
+ <li>delay (optional) - an initial delay in millis to wait before the wait page is shown (returning <code>wait</code> as result code). Default is no initial delay.</li>
+ <li>delaySleepInterval (optional) - only used with delay. Used for waking up at certain intervals to check if the background process is already done. Default is 100 millis.</li>
+
+ </ul>
+
+

#####Extending the Interceptor#####

-
{snippet:id=extending|javadoc=true|url=org.apache.struts2.interceptor.ExecuteAndWaitInterceptor}
-
+
 <p>
+ If you wish to make special preparations before and/or after the invocation of the background thread, you can extend
+ the BackgroundProcess class and implement the beforeInvocation() and afterInvocation() methods. This may be useful
+ for obtaining and releasing resources that the background process will need to execute successfully. To use your
+ background process extension, extend ExecuteAndWaitInterceptor and implement the getNewBackgroundProcess() method.
+ </p>
+

#####Examples#####

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.interceptor.ExecuteAndWaitInterceptor}
-
+

+```xml
+ &lt;action name="someAction" class="com.examples.SomeAction"&gt;
+     &lt;interceptor-ref name="completeStack"/&gt;
+     &lt;interceptor-ref name="execAndWait"/&gt;
+     &lt;result name="wait"&gt;longRunningAction-wait.jsp&lt;/result&gt;
+     &lt;result name="success"&gt;longRunningAction-success.jsp&lt;/result&gt;
+ &lt;/action&gt;
+
+ &lt;%@ taglib prefix="s" uri="/struts" %&gt;
+ &lt;html&gt;
+   &lt;head&gt;
+     &lt;title&gt;Please wait&lt;/title&gt;
+     &lt;meta http-equiv="refresh" content="5;url=&lt;s:url includeParams="all" /&gt;"/&gt;
+   &lt;/head&gt;
+   &lt;body&gt;
+     Please wait while we process your request.
+     Click &lt;a href="&lt;s:url includeParams="all" /&gt;"&gt;&lt;/a&gt; if this page does not reload automatically.
+   &lt;/body&gt;
+ &lt;/html&gt;
+ </pre>
+
+ <p><u>Example code2:</u></p>
+ <p>
+ This example will wait 2 second (2000 millis) before the wait page is shown to the user. Therefore
+ if the long process didn't last long anyway the user isn't shown a wait page.
+ </p>
+
+ <pre>
+ &lt;action name="someAction" class="com.examples.SomeAction"&gt;
+     &lt;interceptor-ref name="completeStack"/&gt;
+     &lt;interceptor-ref name="execAndWait"&gt;
+         &lt;param name="delay"&gt;2000&lt;param&gt;
+     &lt;interceptor-ref&gt;
+     &lt;result name="wait"&gt;longRunningAction-wait.jsp&lt;/result&gt;
+     &lt;result name="success"&gt;longRunningAction-success.jsp&lt;/result&gt;
+ &lt;/action&gt;
+ </pre>
+
+ <p><u>Example code3:</u></p>
+ <p>
+ This example will wait 1 second (1000 millis) before the wait page is shown to the user.
+ And at every 50 millis this interceptor will check if the background process is done, if so
+ it will return before the 1 second has elapsed, and the user isn't shown a wait page.
+ </p>
+
+ <pre>
+ &lt;action name="someAction" class="com.examples.SomeAction"&gt;
+     &lt;interceptor-ref name="completeStack"/&gt;
+     &lt;interceptor-ref name="execAndWait"&gt;
+         &lt;param name="delay"&gt;1000&lt;param&gt;
+         &lt;param name="delaySleepInterval"&gt;50&lt;param&gt;
+     &lt;interceptor-ref&gt;
+     &lt;result name="wait"&gt;longRunningAction-wait.jsp&lt;/result&gt;
+     &lt;result name="success"&gt;longRunningAction-success.jsp&lt;/result&gt;
+ &lt;/action&gt;
+ </pre>
+
+```
+
+
diff --git a/content/core-developers/expression-validator-annotation.html b/content/core-developers/expression-validator-annotation.html index dbaf789..1a31155 100644 --- a/content/core-developers/expression-validator-annotation.html +++ b/content/core-developers/expression-validator-annotation.html @@ -129,26 +129,67 @@ Edit on GitHub

ExpressionValidator Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.ExpressionValidator}
-
+
 This non-field level validator validates a supplied regular expression.
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.ExpressionValidator}
-
+
 <p>The annotation must be applied at method level.</p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.ExpressionValidator}
-
+
 <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'>message</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>field error message</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>key</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>messageParams</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>Additional params to be used to customize message - will be evaluated against the Value Stack</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>shortCircuit</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>false</td>
+ <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> expression </td>
+ <td class='confluenceTd'> yes </td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'> An OGNL expression that returns a boolean value.  </td>
+ </tr>
+ </table>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.ExpressionValidator}
-
+

+```java
+ &#64;ExpressionValidator(message = "Default message", key = "i18n.key", shortCircuit = true, expression = "an OGNL expression" )
+```
+
+
diff --git a/content/core-developers/field-expression-validator-annotation.html b/content/core-developers/field-expression-validator-annotation.html index c31d72d..4f193ab 100644 --- a/content/core-developers/field-expression-validator-annotation.html +++ b/content/core-developers/field-expression-validator-annotation.html @@ -129,26 +129,75 @@ Edit on GitHub

FieldExpressionValidator Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.FieldExpressionValidator}
-
+
 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.
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.FieldExpressionValidator}
-
+
 <p>The annotation must be applied at method level.</p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.FieldExpressionValidator}
-
+
 <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'>message</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>field error message</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>key</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>messageParams</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>Additional params to be used to customize message - will be evaluated against the Value Stack</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>fieldName</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>shortCircuit</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>false</td>
+ <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> expression </td>
+ <td class='confluenceTd'> yes </td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'> An OGNL expression that returns a boolean value.  </td>
+ </tr>
+ </table>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.FieldExpressionValidator}
-
+

+```java
+ &#64;FieldExpressionValidator(message = "Default message", key = "i18n.key", shortCircuit = true, expression = "an OGNL expression")
+```
+
+
diff --git a/content/core-developers/file-upload-interceptor.html b/content/core-developers/file-upload-interceptor.html index 9327252..74fb223 100644 --- a/content/core-developers/file-upload-interceptor.html +++ b/content/core-developers/file-upload-interceptor.html @@ -138,46 +138,149 @@ -
{snippet:id=description|javadoc=true|url=org.apache.struts2.interceptor.FileUploadInterceptor}
-
+
 <p>
+ Interceptor that is based off of {@link MultiPartRequestWrapper}, which is automatically applied for any request that
+ includes a file. It adds the following parameters, where [File Name] is the name given to the file uploaded by the
+ HTML form:
+ </p>
+ <ul>
+
+ <li>[File Name] : File - the actual File</li>
+
+ <li>[File Name]ContentType : String - the content type of the file</li>
+
+ <li>[File Name]FileName : String - the actual name of the file uploaded (not the HTML name)</li>
+
+ </ul>
+
+ <p>You can get access to these files by merely providing setters in your action that correspond to any of the three
+ patterns above, such as setDocument(File document), setDocumentContentType(String contentType), etc.
+ <br>See the example code section.
+ </p>
+
+ <p> This interceptor will add several field errors, assuming that the action implements {@link ValidationAware}.
+ These error messages are based on several i18n values stored in struts-messages.properties, a default i18n file
+ processed for all i18n requests. You can override the text of these messages by providing text for the following
+ keys:
+ </p>
+
+ <ul>
+
+ <li>struts.messages.error.uploading - a general error that occurs when the file could not be uploaded</li>
+
+ <li>struts.messages.error.file.too.large - occurs when the uploaded file is too large</li>
+
+ <li>struts.messages.error.content.type.not.allowed - occurs when the uploaded file does not match the expected
+ content types specified</li>
+
+ <li>struts.messages.error.file.extension.not.allowed - occurs when the uploaded file does not match the expected
+ file extensions specified</li>
+
+ </ul>
+
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=org.apache.struts2.interceptor.FileUploadInterceptor}
-
+

+ <ul>
+
+ <li>maximumSize (optional) - the maximum size (in bytes) that the interceptor will allow a file reference to be set
+ on the action. Note, this is <b>not</b> related to the various properties found in struts.properties.
+ Default to approximately 2MB.</li>
+
+ <li>allowedTypes (optional) - a comma separated list of content types (ie: text/html) that the interceptor will allow
+ a file reference to be set on the action. If none is specified allow all types to be uploaded.</li>
+
+ <li>allowedExtensions (optional) - a comma separated list of file extensions (ie: .html) that the interceptor will allow
+ a file reference to be set on the action. If none is specified allow all extensions to be uploaded.</li>
+ </ul>
+
+
+

#####Extending the Interceptor#####

-
{snippet:id=extending|javadoc=true|url=org.apache.struts2.interceptor.FileUploadInterceptor}
-
+
 <p>
+ You can extend this interceptor and override the acceptFile method to provide more control over which files
+ are supported and which are not.
+ </p>
+

#####Examples#####

Example action mapping:

-
{snippet:id=example-configuration|lang=xml|javadoc=true|url=org.apache.struts2.interceptor.FileUploadInterceptor}
-
+

+```xml
+ &lt;action name="doUpload" class="com.example.UploadAction"&gt;
+     &lt;interceptor-ref name="fileUpload"/&gt;
+     &lt;interceptor-ref name="basicStack"/&gt;
+     &lt;result name="success"&gt;good_result.jsp&lt;/result&gt;
+ &lt;/action&gt;
+```
+
+

Notice the interceptor configuration in the preceding example.

Example JSP form tags:

-
{snippet:id=example-form|lang=xml|javadoc=true|url=org.apache.struts2.interceptor.FileUploadInterceptor}
-
+

+```xml
+   &lt;s:form action="doUpload" method="post" enctype="multipart/form-data"&gt;
+       &lt;s:file name="upload" label="File"/&gt;
+       &lt;s:submit/&gt;
+   &lt;/s:form&gt;
+```
+
+
-
{snippet:id=multipart-note|javadoc=true|url=org.apache.struts2.interceptor.FileUploadInterceptor}
-
+
 <p>
+ You must set the encoding to <code>multipart/form-data</code> in the form where the user selects the file to upload.
+ </p>
+

Example Action class:

-
{snippet:id=example-action|lang=java|javadoc=true|url=org.apache.struts2.interceptor.FileUploadInterceptor}
-
+

+```java
+    package com.example;
+
+    import java.io.File;
+    import com.opensymphony.xwork2.ActionSupport;
+
+    public UploadAction extends ActionSupport {
+       private File file;
+       private String contentType;
+       private String filename;
+
+       public void setUpload(File file) {
+          this.file = file;
+       }
+
+       public void setUploadContentType(String contentType) {
+          this.contentType = contentType;
+       }
+
+       public void setUploadFileName(String filename) {
+          this.filename = filename;
+       }
+
+       public String execute() {
+          //...
+          return SUCCESS;
+       }
+  }
+```
+
+

Setting parameters example:

diff --git a/content/core-developers/file-upload.html b/content/core-developers/file-upload.html index e4784c3..e530199 100644 --- a/content/core-developers/file-upload.html +++ b/content/core-developers/file-upload.html @@ -234,8 +234,15 @@

Example JSP form tags:

-
{snippet:id=example-form|lang=xml|javadoc=true|url=org.apache.struts2.interceptor.FileUploadInterceptor}
-
+

+```xml
+   &lt;s:form action="doUpload" method="post" enctype="multipart/form-data"&gt;
+       &lt;s:file name="upload" label="File"/&gt;
+       &lt;s:submit/&gt;
+   &lt;/s:form&gt;
+```
+
+

The fileUpload interceptor will use setter injection to insert the uploaded file and related data into your Action class. For a form field named upload you would provide the three setter methods shown in the following example:

diff --git a/content/core-developers/input-config-annotation.html b/content/core-developers/input-config-annotation.html index 2a5c46d..e8d341b 100644 --- a/content/core-developers/input-config-annotation.html +++ b/content/core-developers/input-config-annotation.html @@ -129,26 +129,65 @@ Edit on GitHub

InputConfig Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.InputConfig}
-
+
 Marks a action method that if it's not validated by ValidationInterceptor then execute input method or input result.
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.InputConfig}
-
+
 The InputConfig annotation can be applied at method level.
+
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.InputConfig}
-
+
 <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>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.interceptor.annotations.InputConfig}
-
+

+```java
+ public class SampleAction extends ActionSupport {
+
+  public void isValid() throws ValidationException {
+    // validate model object, throw exception if failed
+  }
+
+  &#64;InputConfig(methodName="input")
+  public String execute() {
+     // perform action
+     return SUCCESS;
+  }
+  public String input() {
+     // perform some data filling
+     return INPUT;
+  }
+ }
+```
+
+
diff --git a/content/core-developers/int-range-field-validator-annotation.html b/content/core-developers/int-range-field-validator-annotation.html index d0d050f..c7adb48 100644 --- a/content/core-developers/int-range-field-validator-annotation.html +++ b/content/core-developers/int-range-field-validator-annotation.html @@ -129,26 +129,110 @@ Edit on GitHub

IntRangeFieldValidator Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.IntRangeFieldValidator}
-
+
 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.
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.IntRangeFieldValidator}
-
+
 <p>The annotation must be applied at method level.</p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.IntRangeFieldValidator}
-
+
 <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'>message</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>field error message</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>key</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>messageParams</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>Additional params to be used to customize message - will be evaluated against the Value Stack</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>fieldName</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>shortCircuit</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>false</td>
+ <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>type</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>ValidatorType.FIELD</td>
+ <td class='confluenceTd'>Enum value from ValidatorType. Either FIELD or SIMPLE can be used here.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> min </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'> Integer property. The minimum the number must be.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> minExpression </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>OGNL expression used to obtain the minimum the number must be.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> max </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'> Integer property. The maximum number can be. Can be an expression.!</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> maxExpression </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>OGNL expression used to obtain the maximum number can be.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>parse</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>false</td>
+ <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>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.IntRangeFieldValidator}
-
+

+```java
+ &#64;IntRangeFieldValidator(message = "Default message", key = "i18n.key", shortCircuit = true, min = "0", max = "42")
+
+ &#64;IntRangeFieldValidator(message = "Default message", key = "i18n.key", shortCircuit = true, minExpression = "${minValue}", maxExpression = "${maxValue}")
+```
+
+
diff --git a/content/core-developers/key-annotation.html b/content/core-developers/key-annotation.html index 0bbc775..5c890e3 100644 --- a/content/core-developers/key-annotation.html +++ b/content/core-developers/key-annotation.html @@ -129,26 +129,49 @@ Edit on GitHub

Key Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.util.Key}
-
+
 <p>Sets the Key for type conversion.</p>
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.util.Key}
-
+
 <p>The Key annotation must be applied at field or method level.</p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.util.Key}
-
+
 <table summary="">
+ <thead>
+ <tr>
+ <th>Parameter</th>
+ <th>Required</th>
+ <th>Default</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>value</td>
+ <td>no</td>
+ <td>java.lang.Object.class</td>
+ <td>The key property value.</td>
+ </tr>
+ </tbody>
+ </table>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.util.Key}
-
+

+```java
+ // The key property for User objects within the users collection is the <code>userName</code> attribute.
+ &#64;Key( value = java.lang.Long.class )
+ private Map&lt;Long, User&gt; userMap;
+```
+
+
diff --git a/content/core-developers/key-property-annotation.html b/content/core-developers/key-property-annotation.html index 3979b6a..866737f 100644 --- a/content/core-developers/key-property-annotation.html +++ b/content/core-developers/key-property-annotation.html @@ -129,26 +129,50 @@ Edit on GitHub

KeyProperty Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.util.KeyProperty}
-
+
 <p>Sets the KeyProperty for type conversion.</p>
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.util.KeyProperty}
-
+
 <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>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.util.KeyProperty}
-
+
 <table summary="">
+ <thead>
+ <tr>
+ <th>Parameter</th>
+ <th>Required</th>
+ <th>Default</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>value</td>
+ <td>no</td>
+ <td>id</td>
+ <td>The key property value.</td>
+ </tr>
+ </tbody>
+ </table>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.util.KeyProperty}
-
+

+```java
+ // The key property for User objects within the users collection is the <code>userName</code> attribute.
+ &#64;KeyProperty( value = "userName" )
+ protected List&lt;User&gt; users = null;
+```
+
+
diff --git a/content/core-developers/logger-interceptor.html b/content/core-developers/logger-interceptor.html index efced85..e03770c 100644 --- a/content/core-developers/logger-interceptor.html +++ b/content/core-developers/logger-interceptor.html @@ -129,26 +129,46 @@ Edit on GitHub

Logger Interceptor

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.LoggingInterceptor}
-
+
 <p>
+ This interceptor logs the start and end of the execution an action (in English-only, not internationalized).
+ <br>
+ <b>Note:</b>: This interceptor will log at <tt>INFO</tt> level.
+ </p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.LoggingInterceptor}
-
+
 There are no parameters for this interceptor.
+

#####Extending the Interceptor#####

-
{snippet:id=extending|javadoc=true|url=com.opensymphony.xwork2.interceptor.LoggingInterceptor}
-
+
 There are no obvious extensions to the existing interceptor.
+

#####Examples#####

-
{snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.xwork2.interceptor.LoggingInterceptor}
-
+

+```xml
+ &lt;!-- prints out a message before and after the immediate action execution --&gt;
+ &lt;action name=&quot;someAction&quot; class=&quot;com.examples.SomeAction&quot;&gt;
+     &lt;interceptor-ref name=&quot;completeStack&quot;/&gt;
+     &lt;interceptor-ref name=&quot;logger&quot;/&gt;
+     &lt;result name=&quot;success&quot;&gt;good_result.ftl&lt;/result&gt;
+ &lt;/action&gt;
+
+ &lt;!-- prints out a message before any more interceptors continue and after they have finished --&gt;
+ &lt;action name=&quot;someAction&quot; class=&quot;com.examples.SomeAction&quot;&gt;
+     &lt;interceptor-ref name=&quot;logger&quot;/&gt;
+     &lt;interceptor-ref name=&quot;completeStack&quot;/&gt;
+     &lt;result name=&quot;success&quot;&gt;good_result.ftl&lt;/result&gt;
+ &lt;/action&gt;
+```
+
+
diff --git a/content/core-developers/parameter-filter-interceptor.html b/content/core-developers/parameter-filter-interceptor.html index 62dbeff..aa915c6 100644 --- a/content/core-developers/parameter-filter-interceptor.html +++ b/content/core-developers/parameter-filter-interceptor.html @@ -129,14 +129,50 @@ Edit on GitHub

Parameter Filter Interceptor

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.ParameterFilterInterceptor}
-
+

+ The Parameter Filter Interceptor blocks parameters from getting
+ to the rest of the stack or your action. You can use multiple 
+ parameter filter interceptors for a given action, so, for example,
+ you could use one in your default stack that filtered parameters
+ you wanted blocked from every action and those you wanted blocked 
+ from an individual action you could add an additional interceptor
+ for each action.
+ 
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.ParameterFilterInterceptor}
-
+

+ <ul>
+ <li>allowed - a comma delimited list of parameter prefixes
+  that are allowed to pass to the action</li>
+ <li>blocked - a comma delimited list of parameter prefixes 
+ that are not allowed to pass to the action</li>
+ <li>defaultBlock - boolean (default to false) whether by
+ default a given parameter is blocked. If true, then a parameter
+ must have a prefix in the allowed list in order to be able 
+ to pass to the action
+ </ul>
+ 
+ <p>The way parameters are filtered for the least configuration is that
+ if a string is in the allowed or blocked lists, then any parameter
+ that is a member of the object represented by the parameter is allowed
+ or blocked respectively.</p>
+ 
+ <p>For example, if the parameters are:
+ <ul>
+ <li>blocked: person,person.address.createDate,personDao</li>
+ <li>allowed: person.address</li>
+ <li>defaultBlock: false</li>
+ </ul>
+
+ <p>
+ The parameters person.name, person.phoneNum etc would be blocked 
+ because 'person' is in the blocked list. However, person.address.street
+ and person.address.city would be allowed because person.address is
+ in the allowed list (the longer string determines permissions).</p> 
+

#####Example#####

diff --git a/content/core-developers/postback-result.html b/content/core-developers/postback-result.html index 95a0164..8d32944 100644 --- a/content/core-developers/postback-result.html +++ b/content/core-developers/postback-result.html @@ -131,20 +131,24 @@

####Description####

-
{snippet:id=description|javadoc=true|url=org.apache.struts2.dispatcher.PostbackResult}
-
+
START SNIPPET: description not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/org/apache/struts2/dispatcher/PostbackResult.java;hb=HEAD
+

####Parameters####

-
{snippet:id=params|javadoc=true|url=org.apache.struts2.dispatcher.PostbackResult}
-
+
START SNIPPET: params not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/org/apache/struts2/dispatcher/PostbackResult.java;hb=HEAD
+

####Examples####

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.dispatcher.PostbackResult}
-
+

+```xml
+START SNIPPET: example not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/org/apache/struts2/dispatcher/PostbackResult.java;hb=HEAD
+```
+
+
diff --git a/content/core-developers/prepare-interceptor.html b/content/core-developers/prepare-interceptor.html index dc4e71e..22480d9 100644 --- a/content/core-developers/prepare-interceptor.html +++ b/content/core-developers/prepare-interceptor.html @@ -129,30 +129,86 @@ Edit on GitHub

Prepare Interceptor

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.PrepareInterceptor}
-
+

+ This interceptor calls <code>prepare()</code> on actions which implement
+ {@link Preparable}. This interceptor is very useful for any situation where
+ you need to ensure some logic runs before the actual execute method runs.
+
+ <p>
+ A typical use of this is to run some logic to load an object from the
+ database so that when parameters are set they can be set on this object. For
+ example, suppose you have a User object with two properties: <i>id</i> and
+ <i>name</i>. Provided that the params interceptor is called twice (once
+ before and once after this interceptor), you can load the User object using
+ the id property, and then when the second params interceptor is called the
+ parameter <i>user.name</i> will be set, as desired, on the actual object
+ loaded from the database. See the example for more info.
+ </p>
+ <p>
+ <b>Note:</b> Since XWork 2.0.2, this interceptor extends {@link MethodFilterInterceptor}, therefore being
+ able to deal with excludeMethods / includeMethods parameters. See [Workflow Interceptor]
+ (class {@link DefaultWorkflowInterceptor}) for documentation and examples on how to use this feature.
+ </p>
+
+ <p>
+ <b>Update</b>: Added logic to execute a prepare{MethodName} and conditionally
+ the a general prepare() Method, depending on the 'alwaysInvokePrepare' parameter/property
+ which is by default true. This allows us to run some logic based on the method
+ name we specify in the {@link com.opensymphony.xwork2.ActionProxy}. For example, you can specify a
+ prepareInput() method that will be run before the invocation of the input method.
+ </p>
+
+
-
{snippet:id=javadocPrepareInterceptor|javadoc=true|url=com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil}
-
+
 
+ <b>In PrepareInterceptor</b>
+ <p>Applies only when action implements Preparable</p>
+ <ol>
+    <li>if the action class have prepare{MethodName}(), it will be invoked</li>
+    <li>else if the action class have prepareDo(MethodName()}(), it will be invoked</li>
+    <li>no matter if 1] or 2] is performed, if alwaysinvokePrepare property of the interceptor is "true" (which is by default "true"), prepare() will be invoked.</li>
+ </ol>
+ 
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.PrepareInterceptor}
-
+

+ <ul>
+
+ <li>alwaysInvokePrepare - Default to true. If true, prepare will always be invoked,
+ otherwise it will not.</li>
+
+ </ul>
+
+

#####Extending the Interceptor#####

-
{snippet:id=extending|javadoc=true|url=com.opensymphony.xwork2.interceptor.PrepareInterceptor}
-
+

+ There are no known extension points to this interceptor.
+
+

#####Examples#####

-
{snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.xwork2.interceptor.PrepareInterceptor}
-
+

+```xml
+ &lt;!-- Calls the params interceptor twice, allowing you to
+       pre-load data for the second time parameters are set --&gt;
+  &lt;action name="someAction" class="com.examples.SomeAction"&gt;
+      &lt;interceptor-ref name="params"/&gt;
+      &lt;interceptor-ref name="prepare"/&gt;
+      &lt;interceptor-ref name="basicStack"/&gt;
+      &lt;result name="success"&gt;good_result.ftl&lt;/result&gt;
+  &lt;/action&gt;
+```
+
+
diff --git a/content/core-developers/pure-java-script-client-side-validation.html b/content/core-developers/pure-java-script-client-side-validation.html index ba9a60d..82df6e8 100644 --- a/content/core-developers/pure-java-script-client-side-validation.html +++ b/content/core-developers/pure-java-script-client-side-validation.html @@ -134,8 +134,8 @@ This type of validation uses 100% client-side JavaScript code to try to validate Because the validation logic is actually repeated in the JavaScript code, it is important to understand that some values will be considered acceptable by the JavaScript code but will be marked as unacceptable by the server-side Validation.

-
{snippet:id=supported-validators|url=struts2/core/src/main/resources/template/xhtml/form-close-validate.ftl}
-
+
START SNIPPET: supported-validators not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/core/src/main/resources/template/xhtml/form-close-validate/ftl.java;hb=HEAD
+
diff --git a/content/core-developers/redirect-action-result.html b/content/core-developers/redirect-action-result.html index a17b7c0..869d8f4 100644 --- a/content/core-developers/redirect-action-result.html +++ b/content/core-developers/redirect-action-result.html @@ -129,8 +129,23 @@ Edit on GitHub

Redirect Action Result

-
{snippet:id=description|javadoc=true|url=org.apache.struts2.result.ServletActionRedirectResult}
-
+
 <p>
+ This result uses the {@link ActionMapper} provided by the
+ ActionMapperFactory to redirect the browser to a URL that invokes the
+ specified action and (optional) namespace. This is better than the
+ {@link ServletRedirectResult} because it does not require you to encode the
+ URL patterns processed by the {@link ActionMapper} in to your struts.xml
+ configuration files. This means you can change your URL patterns at any point
+ and your application will still work. It is strongly recommended that if you
+ are redirecting to another action, you use this result rather than the
+ standard redirect result.
+ </p>
+
+ <p>
+ See examples below for an example of how request parameters could be passed
+ in.
+ </p>
+

See ActionMapper for more details

@@ -144,14 +159,75 @@

####Parameters####

-
{snippet:id=params|javadoc=true|url=org.apache.struts2.result.ServletActionRedirectResult}
-
+

+ <ul>
+ <li><b>actionName (default)</b> - The name of the action that will be
+ redirected to.</li>
+ <li><b>namespace</b> - Used to determine which namespace the action is in
+ that we're redirecting to.  If namespace is null, the default will be the
+ current namespace.</li>
+ <li><b>suppressEmptyParameters</b> - Optional boolean (defaults to false) that
+ can prevent parameters with no values from being included in the redirect
+ URL.</li>
+ <li><b>parse</b> - Boolean, true by default.  If set to false, the actionName
+ param will not be parsed for Ognl expressions.</li>
+ <li><b>anchor</b> - Optional.  Also known as "fragment" or colloquially as
+ "hash".  You can specify an anchor for a result.</li>
+ </ul>
+
+

####Examples####

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.result.ServletActionRedirectResult}
-
+

+```xml
+ &lt;package name="public" extends="struts-default"&gt;
+     &lt;action name="login" class="..."&gt;
+         &lt;!-- Redirect to another namespace --&gt;
+         &lt;result type="redirectAction"&gt;
+             &lt;param name="actionName"&gt;dashboard&lt;/param&gt;
+             &lt;param name="namespace"&gt;/secure&lt;/param&gt;
+         &lt;/result&gt;
+     &lt;/action&gt;
+ &lt;/package&gt;
+
+ &lt;package name="secure" extends="struts-default" namespace="/secure"&gt;
+     &lt;-- Redirect to an action in the same namespace --&gt;
+     &lt;action name="dashboard" class="..."&gt;
+         &lt;result&gt;dashboard.jsp&lt;/result&gt;
+         &lt;result name="error" type="redirectAction"&gt;error&lt;/result&gt;
+     &lt;/action&gt;
+
+     &lt;action name="error" class="..."&gt;
+         &lt;result&gt;error.jsp&lt;/result&gt;
+     &lt;/action&gt;
+ &lt;/package&gt;
+
+ &lt;package name="passingRequestParameters" extends="struts-default" namespace="/passingRequestParameters"&gt;
+    &lt;!-- Pass parameters (reportType, width and height) --&gt;
+    &lt;!--
+    The redirectAction url generated will be :
+    /genReport/generateReport.action?reportType=pie&amp;width=100&amp;height=100#summary
+    --&gt;
+    &lt;action name="gatherReportInfo" class="..."&gt;
+       &lt;result name="showReportResult" type="redirectAction"&gt;
+          &lt;param name="actionName"&gt;generateReport&lt;/param&gt;
+          &lt;param name="namespace"&gt;/genReport&lt;/param&gt;
+          &lt;param name="reportType"&gt;pie&lt;/param&gt;
+          &lt;param name="width"&gt;100&lt;/param&gt;
+          &lt;param name="height"&gt;100&lt;/param&gt;
+          &lt;param name="empty"&gt;&lt;/param&gt;
+          &lt;param name="suppressEmptyParameters"&gt;true&lt;/param&gt;
+          &lt;param name="anchor"&gt;summary&lt;/param&gt;
+       &lt;/result&gt;
+    &lt;/action&gt;
+ &lt;/package&gt;
+
+
+```
+
+
<!--
diff --git a/content/core-developers/redirect-result.html b/content/core-developers/redirect-result.html
index e340849..197bad7 100644
--- a/content/core-developers/redirect-result.html
+++ b/content/core-developers/redirect-result.html
@@ -129,20 +129,56 @@
     Edit on GitHub
     

Redirect Result

-
{snippet:id=description|javadoc=true|url=org.apache.struts2.result.ServletRedirectResult}
-
+
 <p>
+ Calls the {@link HttpServletResponse#sendRedirect(String) sendRedirect}
+ method to the location specified. The response is told to redirect the
+ browser to the specified location (a new request from the client). The
+ consequence of doing this means that the action (action instance, action
+ errors, field errors, etc) that was just executed is lost and no longer
+ available. This is because actions are built on a single-thread model. The
+ only way to pass data is through the session or with web parameters
+ (url?name=value) which can be OGNL expressions.
+ </p>
+

####Parameters####

-
{snippet:id=params|javadoc=true|url=org.apache.struts2.result.ServletRedirectResult}
-
+
 
+ <ul>
+ 
+ <li><b>location (default)</b> - the location to go to after execution.</li>
+ 
+ <li><b>parse</b> - true by default. If set to false, the location param will
+ not be parsed for Ognl expressions.</li>
+ 
+ <li><b>anchor</b> - Optional.  Also known as "fragment" or colloquially as 
+ "hash".  You can specify an anchor for a result.</li>
+ </ul>
+ 
+ <p>
+ This result follows the same rules from {@link StrutsResultSupport}.
+ </p>
+ 
+

####Examples####

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.result.ServletRedirectResult}
-
+

+```xml
+ &lt;!--
+   The redirect URL generated will be:
+   /foo.jsp#FRAGMENT
+ --&gt;
+ &lt;result name="success" type="redirect"&gt;
+   &lt;param name="location"&gt;foo.jsp&lt;/param&gt;
+   &lt;param name="parse"&gt;false&lt;/param&gt;
+   &lt;param name="anchor"&gt;FRAGMENT&lt;/param&gt;
+ &lt;/result&gt;
+```
+
+
<package name="passingRequestParameters" extends="struts-default" namespace="/passingRequestParameters">
diff --git a/content/core-developers/regex-field-validator-annotation.html b/content/core-developers/regex-field-validator-annotation.html
index 73e486f..6fbb9fc 100644
--- a/content/core-developers/regex-field-validator-annotation.html
+++ b/content/core-developers/regex-field-validator-annotation.html
@@ -129,26 +129,79 @@
     Edit on GitHub
     

RegexFieldValidator Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.RegexFieldValidator}
-
+
 Validates a string field using a regular expression.
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.RegexFieldValidator}
-
+
 <p>The annotation must be applied at method level.</p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.RegexFieldValidator}
-
+
 <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'>message</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>field error message</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>key</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>messageParams</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>Additional params to be used to customize message - will be evaluated against the Value Stack</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>fieldName</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>shortCircuit</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>false</td>
+ <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>type</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>ValidatorType.FIELD</td>
+ <td class='confluenceTd'>Enum value from ValidatorType. Either FIELD or SIMPLE can be used here.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>regex</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>The regex to validate the field value against.</td>
+ </tr>
+ </table>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.RegexFieldValidator}
-
+

+```java
+ &#64;RegexFieldValidator( key = "regex.field", regex = "yourregexp")
+```
+
+
diff --git a/content/core-developers/required-field-validator-annotation.html b/content/core-developers/required-field-validator-annotation.html index 9714202..4c8c245 100644 --- a/content/core-developers/required-field-validator-annotation.html +++ b/content/core-developers/required-field-validator-annotation.html @@ -129,26 +129,73 @@ Edit on GitHub

RequiredFieldValidator Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator}
-
+
 This validator checks that a field is non-null.
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator}
-
+
 <p>The annotation must be applied at method level.</p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator}
-
+
 <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'>message</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>field error message</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>key</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>messageParams</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>Additional params to be used to customize message - will be evaluated against the Value Stack</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>fieldName</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>shortCircuit</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>false</td>
+ <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>type</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>ValidatorType.FIELD</td>
+ <td class='confluenceTd'>Enum value from ValidatorType. Either FIELD or SIMPLE can be used here.</td>
+ </tr>
+ </table>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator}
-
+

+```java
+ &#64;RequiredFieldValidator(message = "Default message", key = "i18n.key", shortCircuit = true)
+```
+
+
diff --git a/content/core-developers/required-string-validator-annotation.html b/content/core-developers/required-string-validator-annotation.html index abf752e..aa92fda 100644 --- a/content/core-developers/required-string-validator-annotation.html +++ b/content/core-developers/required-string-validator-annotation.html @@ -129,26 +129,79 @@ Edit on GitHub

RequiredStringValidator Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.RequiredStringValidator}
-
+
 This validator checks that a String field is not empty (i.e. non-null with a length &gt; 0).
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.RequiredStringValidator}
-
+
 <p>The annotation must be applied at method level.</p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.RequiredStringValidator}
-
+
 <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'>message</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>field error message</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>key</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>messageParams</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>Additional params to be used to customize message - will be evaluated against the Value Stack</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>fieldName</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>shortCircuit</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>false</td>
+ <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>type</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>ValidatorType.FIELD</td>
+ <td class='confluenceTd'>Enum value from ValidatorType. Either FIELD or SIMPLE can be used here.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> trim </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'> true </td>
+ <td class='confluenceTd'> Boolean property.  Determines whether the String is trimmed before performing the length check.  </td>
+ </tr>
+ </table>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.RequiredStringValidator}
-
+

+```java
+ &#64;RequiredStringValidator(message = "Default message", key = "i18n.key", shortCircuit = true, trim = true)
+```
+
+
diff --git a/content/core-developers/roles-interceptor.html b/content/core-developers/roles-interceptor.html index eec154d..9197911 100644 --- a/content/core-developers/roles-interceptor.html +++ b/content/core-developers/roles-interceptor.html @@ -129,20 +129,41 @@ Edit on GitHub

Roles Interceptor

-
{snippet:id=description|javadoc=true|url=org.apache.struts2.interceptor.RolesInterceptor}
-
+
 <p>
+ This interceptor ensures that the action will only be executed if the user has the correct role.
+ </p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=org.apache.struts2.interceptor.RolesInterceptor}
-
+

+ <ul>
+
+ <li>allowedRoles - a comma-separated list of roles to allow</li>
+
+ <li>disallowedRoles - a comma-separated list of roles to disallow</li>
+
+ </ul>
+
+ <p>
+ When both allowedRoles and disallowedRoles are configured, then disallowedRoles
+ takes precedence, applying the following logic: 
+  (if ((inRole(role1) || inRole(role2) || ... inRole(roleN)) &amp;&amp;
+       !inRole(roleA) &amp;&amp; !inRole(roleB) &amp;&amp; ... !inRole(roleZ))
+  { //permit ...
+ </p>
+

#####Examples#####

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.interceptor.RolesInterceptor}
-
+

+```xml
+START SNIPPET: example not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java;hb=HEAD
+```
+
+
diff --git a/content/core-developers/scope-interceptor.html b/content/core-developers/scope-interceptor.html index 03d1014..26b5171 100644 --- a/content/core-developers/scope-interceptor.html +++ b/content/core-developers/scope-interceptor.html @@ -129,26 +129,109 @@ Edit on GitHub

Scope Interceptor

-
{snippet:id=description|javadoc=true|url=org.apache.struts2.interceptor.ScopeInterceptor}
-
+
 <p>
+ This is designed to solve a few simple issues related to wizard-like functionality in Struts. One of those issues is
+ that some applications have a application-wide parameters commonly used, such <i>pageLen</i> (used for records per
+ page). Rather than requiring that each action check if such parameters are supplied, this interceptor can look for
+ specified parameters and pull them out of the session.
+ </p>
+
+ <p>This works by setting listed properties at action start with values from session/application attributes keyed
+ after the action's class, the action's name, or any supplied key. After action is executed all the listed properties
+ are taken back and put in session or application context.
+ </p>
+
+ <p>To make sure that each execution of the action is consistent it makes use of session-level locking. This way it
+ guarantees that each action execution is atomic at the session level. It doesn't guarantee application level
+ consistency however there has yet to be enough reasons to do so. Application level consistency would also be a big
+ performance overkill.
+ </p>
+
+ <p>Note that this interceptor takes a snapshot of action properties just before result is presented (using a {@link
+ PreResultListener}), rather than after action is invoked. There is a reason for that: At this moment we know that
+ action's state is "complete" as it's values may depend on the rest of the stack and specifically - on the values of
+ nested interceptors.
+ </p>
+
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=org.apache.struts2.interceptor.ScopeInterceptor}
-
+

+ <ul>
+
+ <li>session - a list of action properties to be bound to session scope</li>
+
+ <li>application - a list of action properties to be bound to application scope</li>
+
+ <li>key - a session/application attribute key prefix, can contain following values:
+
+ <ul>
+
+ <li>CLASS - that creates a unique key prefix based on action namespace and action class, it's a default value</li>
+
+ <li>ACTION - creates a unique key prefix based on action namespace and action name</li>
+
+ <li>any other value is taken literally as key prefix</li>
+
+ </ul>
+ </li>
+ <li>type - with one of the following
+
+ <ul>
+
+ <li>start - means it's a start action of the wizard-like action sequence and all session scoped properties are reset
+ to their defaults</li>
+
+ <li>end - means that session scoped properties are removed from session after action is run</li>
+
+ <li>any other value throws IllegalArgumentException</li>
+
+ </ul>
+ </li>
+
+ <li>sessionReset - name of a parameter (defaults to 'session.reset') which if set, causes all session values to be reset to action's default values or application
+ scope values, note that it is similar to type="start" and in fact it does the same, but in our team it is sometimes
+ semantically preferred. We use session scope in two patterns - sometimes there are wizard-like action sequences that
+ have start and end, and sometimes we just want simply reset current session values.</li>
+
+ <li>reset - boolean, defaults to false, if set, it has the same effect as setting all session values to be reset to action's default values or application.</li>
+
+ <li>autoCreateSession - boolean value, sets if the session should be automatically created.</li>
+ </ul>
+
+

#####Extending the Interceptor#####

-
{snippet:id=extending|javadoc=true|url=org.apache.struts2.interceptor.ScopeInterceptor}
-
+

+ <p>There are no know extension points for this interceptor.</p>
+
+

#####Examples#####

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.interceptor.ScopeInterceptor}
-
+

+```xml
+ &lt;!-- As the filter and orderBy parameters are common for all my browse-type actions,
+      you can move control to the scope interceptor. In the session parameter you can list
+      action properties that are going to be automatically managed over session. You can
+      do the same for application-scoped variables--&gt;
+ &lt;action name="someAction" class="com.examples.SomeAction"&gt;
+     &lt;interceptor-ref name="basicStack"/&gt;
+     &lt;interceptor-ref name="hibernate"/&gt;
+     &lt;interceptor-ref name="scope"&gt;
+         &lt;param name="session"&gt;filter,orderBy&lt;/param&gt;
+         &lt;param name="autoCreateSession"&gt;true&lt;/param&gt;
+     &lt;/interceptor-ref&gt;
+     &lt;result name="success"&gt;good_result.ftl&lt;/result&gt;
+ &lt;/action&gt;
+```
+
+

Some more examples

diff --git a/content/core-developers/scoped-model-driven-interceptor.html b/content/core-developers/scoped-model-driven-interceptor.html index a8ce0f1..2283dad 100644 --- a/content/core-developers/scoped-model-driven-interceptor.html +++ b/content/core-developers/scoped-model-driven-interceptor.html @@ -129,26 +129,57 @@ Edit on GitHub

Scoped Model Driven Interceptor

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor}
-
+

+ An interceptor that enables scoped model-driven actions.
+
+ <p>This interceptor only activates on actions that implement the {@link ScopedModelDriven} interface.  If
+ detected, it will retrieve the model class from the configured scope, then provide it to the Action.</p>
+  
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor}
-
+

+ <ul>
+
+ <li>className - The model class name.  Defaults to the class name of the object returned by the getModel() method.</li>
+            
+ <li>name - The key to use when storing or retrieving the instance in a scope.  Defaults to the model
+            class name.</li>
+
+ <li>scope - The scope to store and retrieve the model.  Defaults to 'request' but can also be 'session'.</li>
+ </ul>
+
+

#####Extending the Interceptor#####

-
{snippet:id=extending|javadoc=true|url=com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor}
-
+

+ There are no known extension points for this interceptor.
+
+

#####Examples#####

-
{snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor}
-
+

+```xml
+ 
+ &lt;-- Basic usage --&gt;
+ &lt;interceptor name="scopedModelDriven" class="com.opensymphony.interceptor.ScopedModelDrivenInterceptor" /&gt;
+ 
+ &lt;-- Using all available parameters --&gt;
+ &lt;interceptor name="gangsterForm" class="com.opensymphony.interceptor.ScopedModelDrivenInterceptor"&gt;
+      &lt;param name="scope"&gt;session&lt;/param&gt;
+      &lt;param name="name"&gt;gangsterForm&lt;/param&gt;
+      &lt;param name="className"&gt;com.opensymphony.example.GangsterForm&lt;/param&gt;
+  &lt;/interceptor&gt;
+ 
+```
+
+
diff --git a/content/core-developers/servlet-config-interceptor.html b/content/core-developers/servlet-config-interceptor.html index 53febe4..64497f9 100644 --- a/content/core-developers/servlet-config-interceptor.html +++ b/content/core-developers/servlet-config-interceptor.html @@ -129,26 +129,72 @@ Edit on GitHub

Servlet Config Interceptor

-
{snippet:id=description|javadoc=true|url=org.apache.struts2.interceptor.ServletConfigInterceptor}
-
+
 <p>
+ An interceptor which sets action properties based on the interfaces an action implements. For example, if the action
+ implements {@link ParameterAware} then the action context's parameter map will be set on it.
+ </p>
+
+ <p>This interceptor is designed to set all properties an action needs if it's aware of servlet parameters, the
+ servlet context, the session, etc. Interfaces that it supports are:
+ </p>
+
+ <ul>
+
+ <li>{@link ServletContextAware}</li>
+
+ <li>{@link ServletRequestAware}</li>
+
+ <li>{@link ServletResponseAware}</li>
+
+ <li>{@link ParameterAware} - deprecated since 2.5.4, please use {@link HttpParametersAware}</li>
+
+ <li>{@link HttpParametersAware}</li>
+
+ <li>{@link RequestAware}</li>
+
+ <li>{@link SessionAware}</li>
+
+ <li>{@link ApplicationAware}</li>
+
+ <li>{@link PrincipalAware}</li>
+
+ </ul>
+
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=org.apache.struts2.interceptor.ServletConfigInterceptor}
-
+

+ <ul>
+
+ <li>None</li>
+
+ </ul>
+
+

#####Extending the Interceptor#####

-
{snippet:id=extending|javadoc=true|url=org.apache.struts2.interceptor.ServletConfigInterceptor}
-
+

+ <p>There are no known extension points for this interceptor.</p>
+
+

#####Examples#####

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.interceptor.ServletConfigInterceptor}
-
+

+```xml
+ &lt;action name="someAction" class="com.examples.SomeAction"&gt;
+     &lt;interceptor-ref name="servletConfig"/&gt;
+     &lt;interceptor-ref name="basicStack"/&gt;
+     &lt;result name="success"&gt;good_result.ftl&lt;/result&gt;
+ &lt;/action&gt;
+```
+
+
diff --git a/content/core-developers/static-parameters-interceptor.html b/content/core-developers/static-parameters-interceptor.html index aaf7169..a17f8b5 100644 --- a/content/core-developers/static-parameters-interceptor.html +++ b/content/core-developers/static-parameters-interceptor.html @@ -129,26 +129,50 @@ Edit on GitHub

Static Parameters Interceptor

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.StaticParametersInterceptor}
-
+

+ This interceptor populates the action with the static parameters defined in the action configuration. If the action
+ implements {@link Parameterizable}, a map of the static parameters will be also be passed directly to the action.
+ The static params will be added to the request params map, unless "merge" is set to false.
+
+ <p> Parameters are typically defined with &lt;param&gt; elements within xwork.xml.</p>
+
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.StaticParametersInterceptor}
-
+

+ <ul>
+
+ <li>None</li>
+
+ </ul>
+
+

#####Extending the Interceptor#####

-
{snippet:id=extending|javadoc=true|url=com.opensymphony.xwork2.interceptor.StaticParametersInterceptor}
-
+

+ <p>There are no extension points to this interceptor.</p>
+
+

#####Examples#####

-
{snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.xwork2.interceptor.StaticParametersInterceptor}
-
+

+```xml
+ &lt;action name="someAction" class="com.examples.SomeAction"&gt;
+     &lt;interceptor-ref name="staticParams"&gt;
+          &lt;param name="parse"&gt;true&lt;/param&gt;
+          &lt;param name="overwrite"&gt;false&lt;/param&gt;
+     &lt;/interceptor-ref&gt;
+     &lt;result name="success"&gt;good_result.ftl&lt;/result&gt;
+ &lt;/action&gt;
+```
+
+
diff --git a/content/core-developers/string-length-field-validator-annotation.html b/content/core-developers/string-length-field-validator-annotation.html index 74c46ee..bf0eddb 100644 --- a/content/core-developers/string-length-field-validator-annotation.html +++ b/content/core-developers/string-length-field-validator-annotation.html @@ -129,26 +129,107 @@ Edit on GitHub

StringLengthFieldValidator Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.StringLengthFieldValidator}
-
+
 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.
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.StringLengthFieldValidator}
-
+
 <p>The annotation must be applied at method level.</p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.StringLengthFieldValidator}
-
+
 <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'>message</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>field error message</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>key</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>messageParams</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>Additional params to be used to customize message - will be evaluated against the Value Stack</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>fieldName</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>shortCircuit</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>false</td>
+ <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>type</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>ValidatorType.FIELD</td>
+ <td class='confluenceTd'>Enum value from ValidatorType. Either FIELD or SIMPLE can be used here.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> trim </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'> true </td>
+ <td class='confluenceTd'> Boolean property.  Determines whether the String is trimmed before performing the length check.  </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> minLength </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'> Integer property.  The minimum length the String must be. </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> minLengthExpression </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>OGNL expression used to obtain the minimum length the String must be. </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> maxLength </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'> Integer property.  The maximum length the String can be. </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> maxLengthExpression </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <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>
+
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.StringLengthFieldValidator}
-
+

+```java
+ &#64;StringLengthFieldValidator(message = "Default message", key = "i18n.key", shortCircuit = true, trim = true, minLength = "5",  maxLength = "12")
+```
+
+
diff --git a/content/core-developers/timer-interceptor.html b/content/core-developers/timer-interceptor.html index 9041ef9..ad56af2 100644 --- a/content/core-developers/timer-interceptor.html +++ b/content/core-developers/timer-interceptor.html @@ -129,26 +129,57 @@ Edit on GitHub

Timer Interceptor

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.TimerInterceptor}
-
+
 This interceptor logs the amount of time in milliseconds. In order for this interceptor to work properly, the
+ logging framework must be set to at least the <tt>INFO</tt> level.
+ This interceptor relies on the <a href="http://jakarta.apache.org/commons/logging/">Commons Logging API</a> to
+ report its execution-time value.
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.TimerInterceptor}
-
+

+ <ul>
+
+ <li>logLevel (optional) - what log level should we use (<code>trace, debug, info, warn, error, fatal</code>)? - defaut is <code>info</code></li>
+
+ <li>logCategory (optional) - If provided we would use this category (eg. <code>com.mycompany.app</code>).
+ Default is to use <code>com.opensymphony.xwork2.interceptor.TimerInterceptor</code>.</li>
+
+ </ul>
+
+ The parameters above enables us to log all action execution times in our own logfile.
+
+

#####Extending the Interceptor#####

-
{snippet:id=extending|javadoc=true|url=com.opensymphony.xwork2.interceptor.TimerInterceptor}
-
+
 This interceptor can be extended to provide custom message format. Users should override the
+ <code>invokeUnderTiming</code> method.
+

#####Examples#####

-
{snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.xwork2.interceptor.TimerInterceptor}
-
+

+```xml
+ &lt;!-- records only the action's execution time --&gt;
+ &lt;action name="someAction" class="com.examples.SomeAction"&gt;
+     &lt;interceptor-ref name="completeStack"/&gt;
+     &lt;interceptor-ref name="timer"/&gt;
+     &lt;result name="success"&gt;good_result.ftl&lt;/result&gt;
+ &lt;/action&gt;
+
+ &lt;!-- records action's execution time as well as other interceptors--&gt;
+ &lt;action name="someAction" class="com.examples.SomeAction"&gt;
+     &lt;interceptor-ref name="timer"/&gt;
+     &lt;interceptor-ref name="completeStack"/&gt;
+     &lt;result name="success"&gt;good_result.ftl&lt;/result&gt;
+ &lt;/action&gt;
+```
+
+
diff --git a/content/core-developers/token-interceptor.html b/content/core-developers/token-interceptor.html index 6b23045..9e0d28b 100644 --- a/content/core-developers/token-interceptor.html +++ b/content/core-developers/token-interceptor.html @@ -129,26 +129,85 @@ Edit on GitHub

Token Interceptor

-
{snippet:id=description|javadoc=true|url=org.apache.struts2.interceptor.TokenInterceptor}
-
+
 <p>
+ Ensures that only one request per token is processed. This interceptor can make sure that back buttons and double
+ clicks don't cause un-intended side affects. For example, you can use this to prevent careless users who might double
+ click on a "checkout" button at an online store. This interceptor uses a fairly primitive technique for when an
+ invalid token is found: it returns the result <b>invalid.token</b>, which can be mapped in your action configuration.
+ A more complex implementation, {@link TokenSessionStoreInterceptor}, can provide much better logic for when invalid
+ tokens are found.
+ </p>
+
+ <p>
+ <b>Note:</b> To set a token in your form, you should use the <b>token tag</b>. This tag is required and must be used
+ in the forms that submit to actions protected by this interceptor. Any request that does not provide a token (using
+ the token tag) will be processed as a request with an invalid token.
+ </p>
+
+ <p>
+ <b>Internationalization Note:</b> The following key could be used to internationalized the action errors generated
+ by this token interceptor
+ </p>
+
+ <ul>
+    <li>struts.messages.invalid.token</li>
+ </ul>
+
+ <p>
+ <b>NOTE:</b> As this method extends off MethodFilterInterceptor, it is capable of
+ deciding if it is applicable only to selective methods in the action class. See
+ <code>MethodFilterInterceptor</code> for more info.
+ </p>
+
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=org.apache.struts2.interceptor.TokenInterceptor}
-
+

+ <ul>
+
+ <li>None</li>
+
+ </ul>
+
+

#####Extending the Interceptor#####

-
{snippet:id=extending|javadoc=true|url=org.apache.struts2.interceptor.TokenInterceptor}
-
+
 <p>
+ While not very common for users to extend, this interceptor is extended by the {@link TokenSessionStoreInterceptor}.
+ The {@link #handleInvalidToken}  and {@link #handleValidToken} methods are protected and available for more
+ interesting logic, such as done with the token session interceptor.
+ </p>
+

#####Examples#####

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.interceptor.TokenInterceptor}
-
+

+```xml
+
+ &lt;action name="someAction" class="com.examples.SomeAction"&gt;
+     &lt;interceptor-ref name="token"/&gt;
+     &lt;interceptor-ref name="basicStack"/&gt;
+     &lt;result name="success"&gt;good_result.ftl&lt;/result&gt;
+ &lt;/action&gt;
+
+ &lt;-- In this case, myMethod of the action class will not
+        get checked for invalidity of token --&gt;
+ &lt;action name="someAction" class="com.examples.SomeAction"&gt;
+     &lt;interceptor-ref name="token"&gt;
+        &lt;param name="excludeMethods"&gt;myMethod&lt;/param&gt;
+     &lt;/interceptor-ref name="token"/&gt;
+     &lt;interceptor-ref name="basicStack"/&gt;
+     &lt;result name="success"&gt;good_result.ftl&lt;/result&gt;
+ &lt;/action&gt;
+
+```
+
+
diff --git a/content/core-developers/token-session-interceptor.html b/content/core-developers/token-session-interceptor.html index 425a5f9..cc6e3a3 100644 --- a/content/core-developers/token-session-interceptor.html +++ b/content/core-developers/token-session-interceptor.html @@ -129,26 +129,68 @@ Edit on GitHub

Token Session Interceptor

-
{snippet:id=description|javadoc=true|url=org.apache.struts2.interceptor.TokenSessionStoreInterceptor}
-
+
 <p>
+ This interceptor builds off of the {@link TokenInterceptor}, providing advanced logic for handling invalid tokens.
+ Unlike the normal token interceptor, this interceptor will attempt to provide intelligent fail-over in the event of
+ multiple requests using the same session. That is, it will block subsequent requests until the first request is
+ complete, and then instead of returning the <i>invalid.token</i> code, it will attempt to display the same response
+ that the original, valid action invocation would have displayed if no multiple requests were submitted in the first
+ place.
+ </p>
+
+ <p>
+ <b>NOTE:</b> As this method extends off MethodFilterInterceptor, it is capable of
+ deciding if it is applicable only to selective methods in the action class. See
+ <code>MethodFilterInterceptor</code> for more info.
+ </p>
+
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=org.apache.struts2.interceptor.TokenSessionStoreInterceptor}
-
+

+ <ul>
+
+ <li>None</li>
+
+ </ul>
+
+

#####Extending the Interceptor#####

-
{snippet:id=extending|javadoc=true|url=org.apache.struts2.interceptor.TokenSessionStoreInterceptor}
-
+
 <p>
+ There are no known extension points for this interceptor.
+ </p>
+

#####Examples#####

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.interceptor.TokenSessionStoreInterceptor}
-
+

+```xml
+
+ &lt;action name="someAction" class="com.examples.SomeAction"&gt;
+     &lt;interceptor-ref name="tokenSession/&gt;
+     &lt;interceptor-ref name="basicStack"/&gt;
+     &lt;result name="success"&gt;good_result.ftl&lt;/result&gt;
+ &lt;/action&gt;
+
+ &lt;-- In this case, myMethod of the action class will not
+        get checked for invalidity of token --&gt;
+ &lt;action name="someAction" class="com.examples.SomeAction"&gt;
+     &lt;interceptor-ref name="tokenSession&gt;
+         &lt;param name="excludeMethods"&gt;myMethod&lt;/param&gt;
+     &lt;/interceptor-ref name="tokenSession&gt;
+     &lt;interceptor-ref name="basicStack"/&gt;
+     &lt;result name="success"&gt;good_result.ftl&lt;/result&gt;
+ &lt;/action&gt;
+
+```
+
+
diff --git a/content/core-developers/type-conversion-annotation.html b/content/core-developers/type-conversion-annotation.html index b50eeaf..fc58b90 100644 --- a/content/core-developers/type-conversion-annotation.html +++ b/content/core-developers/type-conversion-annotation.html @@ -129,26 +129,125 @@ Edit on GitHub

TypeConversion Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.conversion.annotations.TypeConversion}
-
+
 <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>
+
+ <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>
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.conversion.annotations.TypeConversion}
-
+
 <p>The TypeConversion annotation can be applied at property and method level.</p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.conversion.annotations.TypeConversion}
-
+
 <table summary="">
+ <thead>
+ <tr>
+ <th>Parameter</th>
+ <th>Required</th>
+ <th>Default</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>key</td>
+ <td>no</td>
+ <td>The annotated property/key name</td>
+ <td>The optional property name mostly used within TYPE level annotations.</td>
+ </tr>
+ <tr>
+ <td>type</td>
+ <td>no</td>
+ <td>ConversionType.CLASS</td>
+ <td>Enum value of ConversionType.  Determines whether the conversion should be applied at application or class level.</td>
+ </tr>
+ <tr>
+ <td>rule</td>
+ <td>no</td>
+ <td>ConversionRule.PROPERTY</td>
+ <td>Enum value of ConversionRule. The ConversionRule can be a property, a Collection or a Map.</td>
+ </tr>
+ <tr>
+ <td>converter</td>
+ <td>DEPRECATED: either this or value</td>
+ <td>&nbsp;</td>
+ <td>The class name of the TypeConverter to be used as converter.</td>
+ </tr>
+ <tr>
+ <td>converterClass</td>
+ <td>either this or value</td>
+ <td>&nbsp;</td>
+ <td>The class of the TypeConverter to be used as converter. XWorkBasicConverter by default.</td>
+ </tr>
+ <tr>
+ <td>value</td>
+ <td>either converter or this</td>
+ <td>&nbsp;</td>
+ <td>The value to set for ConversionRule.KEY_PROPERTY.</td>
+ </tr>
+ </tbody>
+ </table>
+
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.conversion.annotations.TypeConversion}
-
+

+```java
+ &#64;Conversion()
+ public class ConversionAction implements Action {
+
+   private String convertInt;
+
+   private String convertDouble;
+   private List users = null;
+
+   private HashMap keyValues = null;
+
+   &#64;TypeConversion(type = ConversionType.APPLICATION)
+   public void setConvertInt( String convertInt ) {
+       this.convertInt = convertInt;
+   }
+
+   &#64;TypeConversion(converterClass = XWorkBasicConverter.class)
+   public void setConvertDouble( String convertDouble ) {
+       this.convertDouble = convertDouble;
+   }
+
+   &#64;TypeConversion(rule = ConversionRule.COLLECTION, converterClass = String.class)
+   public void setUsers( List users ) {
+       this.users = users;
+   }
+
+   &#64;TypeConversion(rule = ConversionRule.MAP, converterClass = BigInteger.class)
+   public void setKeyValues( HashMap keyValues ) {
+       this.keyValues = keyValues;
+   }
+
+   &#64;TypeConversion(type = ConversionType.APPLICATION, property = "java.util.Date", converterClass = XWorkBasicConverter.class)
+   public String execute() throws Exception {
+       return SUCCESS;
+   }
+ }
+```
+
+
diff --git a/content/core-developers/using-field-validators.html b/content/core-developers/using-field-validators.html index b6e655d..b97998d 100644 --- a/content/core-developers/using-field-validators.html +++ b/content/core-developers/using-field-validators.html @@ -137,24 +137,36 @@

Create the jsp page

-
{snippet:id=fieldValidatorsExample|lang=xml|javadoc=false|url=struts2/apps/showcase/src/main/webapp/WEB-INF/validation/fieldValidatorsExample.jsp}
-
+

+```xml
+START SNIPPET: fieldValidatorsExample not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/apps/showcase/src/main/webapp/WEB-INF/validation/fieldValidatorsExample/jsp.java;hb=HEAD
+```
+
+

Step 2

Create the action class

-
{snippet:id=fieldValidatorsExample|javadoc=false|lang=java|url=struts2/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction.java}
-
+

+```java
+START SNIPPET: fieldValidatorsExample not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction/java.java;hb=HEAD
+```
+
+

Step 3

Create the validator.xml.

-
{snippet:id=fieldValidatorsExample|javadoc=false|lang=xml|url=struts2/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction-submitFieldValidatorsExamples-validation.xml}
-
+

+```xml
+START SNIPPET: fieldValidatorsExample not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction-submitFieldValidatorsExamples-validation/xml.java;hb=HEAD
+```
+
+
diff --git a/content/core-developers/using-non-field-validators.html b/content/core-developers/using-non-field-validators.html index f00cec8..2b76b26 100644 --- a/content/core-developers/using-non-field-validators.html +++ b/content/core-developers/using-non-field-validators.html @@ -137,24 +137,36 @@

Create the jsp page

-
{snippet:id=nonFieldValidatorsExample|lang=xml|javadoc=false|url=struts2/apps/showcase/src/main/webapp/WEB-INF/validation/nonFieldValidatorsExample.jsp}
-
+

+```xml
+START SNIPPET: nonFieldValidatorsExample not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/apps/showcase/src/main/webapp/WEB-INF/validation/nonFieldValidatorsExample/jsp.java;hb=HEAD
+```
+
+

Step 2

Create the action class

-
{snippet:id=nonFieldValidatorsExample|javadoc=false|lang=java|url=struts2/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/NonFieldValidatorsExampleAction.java}
-
+

+```java
+START SNIPPET: nonFieldValidatorsExample not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/NonFieldValidatorsExampleAction/java.java;hb=HEAD
+```
+
+

Step 3

Create the validator.xml.

-
{snippet:id=nonFieldValidatorsExample|javadoc=false|lang=xml|url=struts2/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/NonFieldValidatorsExampleAction-submitNonFieldValidatorsExamples-validation.xml}
-
+

+```xml
+START SNIPPET: nonFieldValidatorsExample not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/NonFieldValidatorsExampleAction-submitNonFieldValidatorsExamples-validation/xml.java;hb=HEAD
+```
+
+
diff --git a/content/core-developers/using-visitor-field-validator.html b/content/core-developers/using-visitor-field-validator.html index c03ddc9..90aaf21 100644 --- a/content/core-developers/using-visitor-field-validator.html +++ b/content/core-developers/using-visitor-field-validator.html @@ -137,24 +137,36 @@

Create the jsp page.

-
{snippet:id=visitorValidatorsExample|lang=xml|javadoc=false|url=struts2/apps/showcase/src/main/webapp/WEB-INF/validation/visitorValidatorsExample.jsp}
-
+

+```xml
+START SNIPPET: visitorValidatorsExample not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/apps/showcase/src/main/webapp/WEB-INF/validation/visitorValidatorsExample/jsp.java;hb=HEAD
+```
+
+

Step 2

Create the action class.

-
{snippet:id=visitorValidatorsExample|javadoc=false|lang=java|url=struts2/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/VisitorValidatorsExampleAction.java}
-
+

+```java
+START SNIPPET: visitorValidatorsExample not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/VisitorValidatorsExampleAction/java.java;hb=HEAD
+```
+
+

Step 3

Create the validator.xml.

-
{snippet:id=visitorValidatorsExample|javadoc=false|lang=xml|url=struts2/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/VisitorValidatorsExampleAction-submitVisitorValidatorsExamples-validation.xml}
-
+

+```xml
+START SNIPPET: visitorValidatorsExample not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/apps/showcase/src/main/resources/org/apache/struts2/showcase/validation/VisitorValidatorsExampleAction-submitVisitorValidatorsExamples-validation/xml.java;hb=HEAD
+```
+
+
diff --git a/content/core-developers/validation-annotation.html b/content/core-developers/validation-annotation.html index ed2fd29..85bca3d 100644 --- a/content/core-developers/validation-annotation.html +++ b/content/core-developers/validation-annotation.html @@ -129,20 +129,34 @@ Edit on GitHub

Validation Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.Validation}
-
+
 This annotation has been deprecated since 2.1 as its previous purpose, to define classes that support annotation validations,
+ is no longer necessary.
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.Validation}
-
+
 <p>The Validation annotation must be applied at Type level.</p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.Validation}
-
+
 <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'>&nbsp;</td>
+ <td class='confluenceTd'></td>
+ </tr>
+ </table>
+

#####Examples#####

@@ -158,14 +172,74 @@ -
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.Validation}
-
+

+```java
+ &#64;Validation()
+ public interface AnnotationDataAware {
+
+     void setBarObj(Bar b);
+
+     Bar getBarObj();
+
+     &#64;RequiredFieldValidator(message = "You must enter a value for data.")
+     &#64;RequiredStringValidator(message = "You must enter a value for data.")
+     void setData(String data);
+
+     String getData();
+ }
+```
+
+

An Annotated Class

-
{snippet:id=example2|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.Validation}
-
+

+```java
+ &#64;Validation()
+ public class SimpleAnnotationAction extends ActionSupport {
+
+     &#64;RequiredFieldValidator(type = ValidatorType.FIELD, message = "You must enter a value for bar.")
+     &#64;IntRangeFieldValidator(type = ValidatorType.FIELD, min = "6", max = "10", message = "bar must be between ${min} and ${max}, current value is ${bar}.")
+     public void setBar(int bar) {
+         this.bar = bar;
+     }
+
+     public int getBar() {
+         return bar;
+     }
+
+     &#64;Validations(
+             requiredFields =
+                     {&#64;RequiredFieldValidator(type = ValidatorType.SIMPLE, fieldName = "customfield", message = "You must enter a value for field.")},
+             requiredStrings =
+                     {&#64;RequiredStringValidator(type = ValidatorType.SIMPLE, fieldName = "stringisrequired", message = "You must enter a value for string.")},
+             emails =
+                     { &#64;EmailValidator(type = ValidatorType.SIMPLE, fieldName = "emailaddress", message = "You must enter a value for email.")},
+             urls =
+                     { &#64;UrlValidator(type = ValidatorType.SIMPLE, fieldName = "hreflocation", message = "You must enter a value for email.")},
+             stringLengthFields =
+                     {&#64;StringLengthFieldValidator(type = ValidatorType.SIMPLE, trim = true, minLength="10" , maxLength = "12", fieldName = "needstringlength", message = "You must enter a stringlength.")},
+             intRangeFields =
+                     { @IntRangeFieldValidator(type = ValidatorType.SIMPLE, fieldName = "intfield", min = "6", max = "10", message = "bar must be between ${min} and ${max}, current value is ${bar}.")},
+             dateRangeFields =
+                     {&#64;DateRangeFieldValidator(type = ValidatorType.SIMPLE, fieldName = "datefield", min = "-1", max = "99", message = "bar must be between ${min} and ${max}, current value is ${bar}.")},
+             expressions = {
+                 &#64;ExpressionValidator(expression = "foo &gt; 1", message = "Foo must be greater than Bar 1. Foo = ${foo}, Bar = ${bar}."),
+                 &#64;ExpressionValidator(expression = "foo &gt; 2", message = "Foo must be greater than Bar 2. Foo = ${foo}, Bar = ${bar}."),
+                 &#64;ExpressionValidator(expression = "foo &gt; 3", message = "Foo must be greater than Bar 3. Foo = ${foo}, Bar = ${bar}."),
+                 &#64;ExpressionValidator(expression = "foo &gt; 4", message = "Foo must be greater than Bar 4. Foo = ${foo}, Bar = ${bar}."),
+                 &#64;ExpressionValidator(expression = "foo &gt; 5", message = "Foo must be greater than Bar 5. Foo = ${foo}, Bar = ${bar}.")
+     }
+     )
+     public String execute() throws Exception {
+         return SUCCESS;
+     }
+ }
+
+```
+
+
diff --git a/content/core-developers/validation-interceptor.html b/content/core-developers/validation-interceptor.html index cd55651..6277d17 100644 --- a/content/core-developers/validation-interceptor.html +++ b/content/core-developers/validation-interceptor.html @@ -129,26 +129,101 @@ Edit on GitHub

Validation Interceptor

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.validator.ValidationInterceptor}
-
+

+ <p>
+ This interceptor runs the action through the standard validation framework, which in turn checks the action against
+ any validation rules (found in files such as <i>ActionClass-validation.xml</i>) and adds field-level and action-level
+ error messages (provided that the action implements {@link ValidationAware}). This interceptor
+ is often one of the last (or second to last) interceptors applied in a stack, as it assumes that all values have
+ already been set on the action.
+ </p>
+
+ <p>
+ This interceptor does nothing if the name of the method being invoked is specified in the <b>excludeMethods</b>
+ parameter. <b>excludeMethods</b> accepts a comma-delimited list of method names. For example, requests to
+ <b>foo!input.action</b> and <b>foo!back.action</b> will be skipped by this interceptor if you set the
+ <b>excludeMethods</b> parameter to "input, back".
+ </p>
+
+ <p>
+ The workflow of the action request does not change due to this interceptor. Rather,
+ this interceptor is often used in conjunction with the <b>workflow</b> interceptor.
+ </p>
+
+ <p>
+ <b>NOTE:</b> As this method extends off MethodFilterInterceptor, it is capable of
+ deciding if it is applicable only to selective methods in the action class. See
+ <code>MethodFilterInterceptor</code> for more info.
+ </p>
+
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.ValidationInterceptor}
-
+

+ <ul>
+
+ <li>alwaysInvokeValidate - Defaults to true. If true validate() method will always
+ be invoked, otherwise it will not.</li>
+
+ <li>programmatic - Defaults to true. If true and the action is Validateable call validate(),
+ and any method that starts with "validate".
+ </li>
+ 
+ <li>declarative - Defaults to true. Perform validation based on xml or annotations.</li>
+ 
+ </ul>
+
+

#####Extending the Interceptor#####

-
{snippet:id=extending|javadoc=true|url=com.opensymphony.xwork2.validator.ValidationInterceptor}
-
+

+ There are no known extension points for this interceptor.
+
+

#####Examples#####

-
{snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.xwork2.validator.ValidationInterceptor}
-
+

+```xml
+ 
+ &lt;action name=&quot;someAction&quot; class=&quot;com.examples.SomeAction&quot;&gt;
+     &lt;interceptor-ref name=&quot;params&quot;/&gt;
+     &lt;interceptor-ref name=&quot;validation&quot;/&gt;
+     &lt;interceptor-ref name=&quot;workflow&quot;/&gt;
+     &lt;result name=&quot;success&quot;&gt;good_result.ftl&lt;/result&gt;
+ &lt;/action&gt;
+ 
+ &lt;-- in the following case myMethod of the action class will not
+        get validated --&gt;
+ &lt;action name=&quot;someAction&quot; class=&quot;com.examples.SomeAction&quot;&gt;
+     &lt;interceptor-ref name=&quot;params&quot;/&gt;
+     &lt;interceptor-ref name=&quot;validation&quot;&gt;
+         &lt;param name=&quot;excludeMethods&quot;&gt;myMethod&lt;/param&gt;
+     &lt;/interceptor-ref&gt;
+     &lt;interceptor-ref name=&quot;workflow&quot;/&gt;
+     &lt;result name=&quot;success&quot;&gt;good_result.ftl&lt;/result&gt;
+ &lt;/action&gt;
+ 
+ &lt;-- in the following case only annotated methods of the action class will
+        be validated --&gt;
+ &lt;action name=&quot;someAction&quot; class=&quot;com.examples.SomeAction&quot;&gt;
+     &lt;interceptor-ref name=&quot;params&quot;/&gt;
+     &lt;interceptor-ref name=&quot;validation&quot;&gt;
+         &lt;param name=&quot;validateAnnotatedMethodOnly&quot;&gt;true&lt;/param&gt;
+     &lt;/interceptor-ref&gt;
+     &lt;interceptor-ref name=&quot;workflow&quot;/&gt;
+     &lt;result name=&quot;success&quot;&gt;good_result.ftl&lt;/result&gt;
+ &lt;/action&gt;
+
+
+```
+
+
diff --git a/content/core-developers/validation-parameter-annotation.html b/content/core-developers/validation-parameter-annotation.html index 0f36589..047d478 100644 --- a/content/core-developers/validation-parameter-annotation.html +++ b/content/core-developers/validation-parameter-annotation.html @@ -129,26 +129,53 @@ Edit on GitHub

ValidationParameter annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.ValidationParameter}
-
+
 The ValidationParameter annotation is used as a parameter for CustomValidators.
+

Usage

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.ValidationParameter}
-
+
 <p>The annotation must embedded into CustomValidator annotations as a parameter.</p>
+

Parameters

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.ValidationParameter}
-
+
 <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'>name</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>parameter name.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>value</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>parameter value.</td>
+ </tr>
+ </table>
+

Examples

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.ValidationParameter}
-
+

+```java
+ &#64;CustomValidator(
+   type ="customValidatorName",
+   fieldName = "myField",
+   parameters = { &#64;ValidationParameter( name = "paramName", value = "paramValue" ) }
+ )
+```
+
+
diff --git a/content/core-developers/validations-annotation.html b/content/core-developers/validations-annotation.html index 9cd2aa2..9da3002 100644 --- a/content/core-developers/validations-annotation.html +++ b/content/core-developers/validations-annotation.html @@ -129,26 +129,133 @@ Edit on GitHub

Validations Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.Validations}
-
+
 <p>If you want to use several annotations of the same type, these annotations must be nested within the @Validations() annotation.</p>
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.Validations}
-
+
 <p>Used at METHOD level.</p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.Validations}
-
+
 <table class='confluenceTable' summary=''>
+
+ <tr>
+ <th class='confluenceTh'> Parameter </th>
+ <th class='confluenceTh'> Required </th>
+ <th class='confluenceTh'> Notes </th>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> requiredFields </td>
+ <td class='confluenceTd'> no </td>
+
+ <td class='confluenceTd'> Add list of RequiredFieldValidators  </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> customValidators </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'> Add list of CustomValidators </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> conversionErrorFields </td>
+
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'> Add list of ConversionErrorFieldValidators </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> dateRangeFields </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'> Add list of DateRangeFieldValidators </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> emails </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'> Add list of EmailValidators </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> fieldExpressions </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'> Add list of FieldExpressionValidators </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> intRangeFields </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'> Add list of IntRangeFieldValidators </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> requiredStrings </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'> Add list of RequiredStringValidators </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> stringLengthFields </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'> Add list of StringLengthFieldValidators </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> urls </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'> Add list of UrlValidators </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> visitorFields </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'> Add list of VisitorFieldValidators </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> regexFields </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'> Add list of RegexFieldValidator </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> expressions </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'> Add list of ExpressionValidator </td>
+ </tr>
+ </table>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.Validations}
-
+

+```java
+ &#64;Validations(
+           requiredFields =
+                   {&#64;RequiredFieldValidator(type = ValidatorType.SIMPLE, fieldName = "customfield", message = "You must enter a value for field.")},
+           requiredStrings =
+                   {&#64;RequiredStringValidator(type = ValidatorType.SIMPLE, fieldName = "stringisrequired", message = "You must enter a value for string.")},
+           emails =
+                   { &#64;EmailValidator(type = ValidatorType.SIMPLE, fieldName = "emailaddress", message = "You must enter a value for email.")},
+           urls =
+                   { &#64;UrlValidator(type = ValidatorType.SIMPLE, fieldName = "hreflocation", message = "You must enter a value for email.")},
+           stringLengthFields =
+                   {&#64;StringLengthFieldValidator(type = ValidatorType.SIMPLE, trim = true, minLength="10" , maxLength = "12", fieldName = "needstringlength", message = "You must enter a stringlength.")},
+           intRangeFields =
+                   { &#64;IntRangeFieldValidator(type = ValidatorType.SIMPLE, fieldName = "intfield", min = "6", max = "10", message = "bar must be between ${min} and ${max}, current value is ${bar}.")},
+           longRangeFields =
+                   { &#64;LongRangeFieldValidator(type = ValidatorType.SIMPLE, fieldName = "intfield", min = "6", max = "10", message = "bar must be between ${min} and ${max}, current value is ${bar}.")},
+           shortRangeFields =
+                   { &#64;ShortRangeFieldValidator(type = ValidatorType.SIMPLE, fieldName = "shortfield", min = "1", max = "128", message = "bar must be between ${min} and ${max}, current value is ${bar}.")},
+           dateRangeFields =
+                   {&#64;DateRangeFieldValidator(type = ValidatorType.SIMPLE, fieldName = "datefield", min = "-1", max = "99", message = "bar must be between ${min} and ${max}, current value is ${bar}.")},
+           expressions = {
+               &#64;ExpressionValidator(expression = "foo &gt; 1", message = "Foo must be greater than Bar 1. Foo = ${foo}, Bar = ${bar}."),
+               &#64;ExpressionValidator(expression = "foo &gt; 2", message = "Foo must be greater than Bar 2. Foo = ${foo}, Bar = ${bar}."),
+               &#64;ExpressionValidator(expression = "foo &gt; 3", message = "Foo must be greater than Bar 3. Foo = ${foo}, Bar = ${bar}."),
+               &#64;ExpressionValidator(expression = "foo &gt; 4", message = "Foo must be greater than Bar 4. Foo = ${foo}, Bar = ${bar}."),
+               &#64;ExpressionValidator(expression = "foo &gt; 5", message = "Foo must be greater than Bar 5. Foo = ${foo}, Bar = ${bar}.")
+   }
+   )
+   public String execute() throws Exception {
+       return SUCCESS;
+   }
+```
+
+

#####Different validations per method#####

diff --git a/content/core-developers/velocity-result.html b/content/core-developers/velocity-result.html index e325c46..087be46 100644 --- a/content/core-developers/velocity-result.html +++ b/content/core-developers/velocity-result.html @@ -129,20 +129,24 @@ Edit on GitHub

Velocity Result

-
{snippet:id=description|javadoc=true|url=org.apache.struts2.dispatcher.VelocityResult}
-
+
START SNIPPET: description not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/org/apache/struts2/dispatcher/VelocityResult.java;hb=HEAD
+

####Parameters####

-
{snippet:id=params|javadoc=true|url=org.apache.struts2.dispatcher.VelocityResult}
-
+
START SNIPPET: params not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/org/apache/struts2/dispatcher/VelocityResult.java;hb=HEAD
+

####Examples####

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.dispatcher.VelocityResult}
-
+

+```xml
+START SNIPPET: example not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/org/apache/struts2/dispatcher/VelocityResult.java;hb=HEAD
+```
+
+
diff --git a/content/core-developers/visitor-field-validator-annotation.html b/content/core-developers/visitor-field-validator-annotation.html index 37109eb..85ddf12 100644 --- a/content/core-developers/visitor-field-validator-annotation.html +++ b/content/core-developers/visitor-field-validator-annotation.html @@ -129,26 +129,86 @@ Edit on GitHub

VisitorFieldValidator Annotation

-
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.VisitorFieldValidator}
-
+
 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.
+
+ 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.
+

#####Usage#####

-
{snippet:id=usage|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.VisitorFieldValidator}
-
+
 <p>The annotation must be applied at method level.</p>
+

#####Parameters#####

-
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.VisitorFieldValidator}
-
+
 <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'>message</td>
+ <td class='confluenceTd'>yes</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>field error message</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>key</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>messageParams</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>Additional params to be used to customize message - will be evaluated against the Value Stack</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>fieldName</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ <td class='confluenceTd'>&nbsp;</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'>shortCircuit</td>
+ <td class='confluenceTd'>no</td>
+ <td class='confluenceTd'>false</td>
+ <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> context </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'> action alias </td>
+ <td class='confluenceTd'> Determines the context to use for validating the Object property. If not defined, the context of the Action validation is propogated to the Object property validation.  In the case of Action validation, this context is the Action alias.  </td>
+ </tr>
+ <tr>
+ <td class='confluenceTd'> appendPrefix </td>
+ <td class='confluenceTd'> no </td>
+ <td class='confluenceTd'> true </td>
+ <td class='confluenceTd'> Determines whether the field name of this field validator should be prepended to the field name of the visited field to determine the full field name when an error occurs.  For example, suppose that the bean being validated has a "name" property.  If <em>appendPrefix</em> is true, then the field error will be stored under the field "bean.name".  If <em>appendPrefix</em> is false, then the field error will be stored under the field  [...]
+ </tr>
+ </table>
+

#####Examples#####

-
{snippet:id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.VisitorFieldValidator}
-
+

+```java
+ &#64;VisitorFieldValidator(message = "Default message", key = "i18n.key", shortCircuit = true, context = "action alias", appendPrefix = true)
+```
+
+
diff --git a/content/tag-developers/action-tag.html b/content/tag-developers/action-tag.html index 9f84f1e..dd40100 100644 --- a/content/tag-developers/action-tag.html +++ b/content/tag-developers/action-tag.html @@ -133,8 +133,10 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.ActionComponent}
-
+
 <p>This tag enables developers to call actions directly from a JSP page by specifying the action name and an optional
+ namespace.  The body content of the tag is used to render the results from the Action.  Any result processor defined
+ for this action in struts.xml will be ignored, <i>unless</i> the executeResult parameter is specified.</p>
+

Parameters can be passed to the action using nested param tags.

@@ -235,16 +237,58 @@ the action cannot be accessed, For example:

Examples

-
{snippet:id=javacode|javadoc=true|lang=java|url=org.apache.struts2.components.ActionComponent}
-
+

+```java
+ public class ActionTagAction extends ActionSupport {
+
+  public String execute() throws Exception {
+      return "done";
+  }
+
+  public String doDefault() throws Exception {
+      ServletActionContext.getRequest().setAttribute("stringByAction", "This is a String put in by the action's doDefault()");
+      return "done";
+  }
+ }
+```
+
+
-
{snippet:id=strutsxml|javadoc=true|lang=xml|url=org.apache.struts2.components.ActionComponent}
-
+

+```xml
+   &lt;xwork&gt;
+      ....
+     &lt;action name=&quot;actionTagAction1&quot; class=&quot;tmjee.testing.ActionTagAction&quot;&gt;
+         &lt;result name=&quot;done&quot;&gt;success.jsp&lt;/result&gt;
+     &lt;/action&gt;
+      &lt;action name=&quot;actionTagAction2&quot; class=&quot;tmjee.testing.ActionTagAction&quot; method=&quot;default&quot;&gt;
+         &lt;result name=&quot;done&quot;&gt;success.jsp&lt;/result&gt;
+     &lt;/action&gt;
+      ....
+   &lt;/xwork&gt;
+```
+
+
-
{snippet:id=example|javadoc=true|lang=xml|url=org.apache.struts2.components.ActionComponent}
-
+

+```xml
+  <span>The following action tag will execute result and include it in this page</span>
+  <br>
+  &lt;s:action name=&quot;actionTagAction&quot; executeResult=&quot;true&quot; /&gt;
+  <br>
+  <span>The following action tag will do the same as above, but invokes method specialMethod in action</span>
+  <br>
+  &lt;s:action name=&quot;actionTagAction!specialMethod&quot; executeResult=&quot;true&quot; /&gt;
+  <br>
+  <span>The following action tag will not execute result, but put a String in request scope
+       under an id "stringByAction" which will be retrieved using property tag</span>
+  &lt;s:action name=&quot;actionTagAction!default&quot; executeResult=&quot;false&quot; /&gt;
+  &lt;s:property value=&quot;#attr.stringByAction&quot; /&gt;
+```
+
+
diff --git a/content/tag-developers/actionerror-tag.html b/content/tag-developers/actionerror-tag.html index 06e788c..16d87d3 100644 --- a/content/tag-developers/actionerror-tag.html +++ b/content/tag-developers/actionerror-tag.html @@ -131,20 +131,33 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.ActionError}
-
+

+ Render action errors if they exists the specific layout of the rendering depends on
+ the theme itself. Empty (null or blank string) errors will not be printed. The action error
+ strings will be html escaped by default.
+
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/actionerror.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/actionerror/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.ActionError}
-
+

+```xml
+
+    &lt;s:actionerror /&gt;
+    &lt;s:form .... &gt;
+       ....
+    &lt;/s:form&gt;
+
+```
+
+
diff --git a/content/tag-developers/actionmessage-tag.html b/content/tag-developers/actionmessage-tag.html index 18877ab..ae702e9 100644 --- a/content/tag-developers/actionmessage-tag.html +++ b/content/tag-developers/actionmessage-tag.html @@ -131,20 +131,31 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.ActionMessage}
-
+

+ Render action messages if they exists, specific rendering layout depends on the
+ theme itself. Empty (null or blank string) messages will not be printed. The action message
+ strings will be html escaped by default.
+
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/actionmessage.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/actionmessage/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.ActionMessage}
-
+

+```xml
+    &lt;s:actionmessage /&gt;
+    &lt;s:form .... &gt;
+       ....
+    &lt;/s:form&gt;
+```
+
+
diff --git a/content/tag-developers/ajax-common-header.html b/content/tag-developers/ajax-common-header.html index 59fc9eb..0d9d530 100644 --- a/content/tag-developers/ajax-common-header.html +++ b/content/tag-developers/ajax-common-header.html @@ -143,70 +143,106 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter/java.java;hb=HEAD
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/autocompleter.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/autocompleter/html.java;hb=HEAD
+

Examples

Get list from an action:

-
{snippet:id=example1|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}
-
+

+```xml
+START SNIPPET: example1 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter/java.java;hb=HEAD
+```
+
+

Uses a list:

-
{snippet:id=example2|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}
-
+

+```xml
+START SNIPPET: example2 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter/java.java;hb=HEAD
+```
+
+

Autocompleter that reloads its content everytime the text changes (and the length of the text is greater than 3):

-
{snippet:id=example3|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}
-
+

+```xml
+START SNIPPET: example3 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter/java.java;hb=HEAD
+```
+
+

Linking two autocompleters:

-
{snippet:id=example4|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}
-
+

+```xml
+START SNIPPET: example4 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter/java.java;hb=HEAD
+```
+
+

Set/Get selected values using JavaScript:

-
{snippet:id=example5|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}
-
+

+```xml
+START SNIPPET: example5 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter/java.java;hb=HEAD
+```
+
+

Using beforeNotifyTopics:

-
{snippet:id=example6|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}
-
+

+```xml
+START SNIPPET: example6 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter/java.java;hb=HEAD
+```
+
+

Using errorNotifyTopics:

-
{snippet:id=example7|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}
-
+

+```xml
+START SNIPPET: example7 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter/java.java;hb=HEAD
+```
+
+

Using errorNotifyTopics:

-
{snippet:id=example8|lang=html|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}
-
+

+```html
+START SNIPPET: example8 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter/java.java;hb=HEAD
+```
+
+

Using valueNotifyTopics:

-
{snippet:id=example9|lang=html|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}
-
+

+```html
+START SNIPPET: example9 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter/java.java;hb=HEAD
+```
+
+

Caveats

@@ -228,8 +264,8 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind/java.java;hb=HEAD
+

There’s a bug in IE6/IE7 which makes impossible to use the target’s attribute with a parent Div, because such Div’s content’s are overwritten with the tag’s loadingText . Resulting in an “undefined” message in the content’s, instead of the result of the request.

@@ -250,46 +286,70 @@

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/bind.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/bind/html.java;hb=HEAD
+

Examples

Without attaching to an event, listening to a topic (used to make an Ajax call):

-
{snippet:id=example0|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind.java}
-
+

+```xml
+START SNIPPET: example0 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind/java.java;hb=HEAD
+```
+
+

Attached to event ‘onclick’ on submit button:

-
{snippet:id=example1|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind.java}
-
+

+```xml
+START SNIPPET: example1 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind/java.java;hb=HEAD
+```
+
+

Submit form:

-
{snippet:id=example2|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind.java}
-
+

+```xml
+START SNIPPET: example2 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind/java.java;hb=HEAD
+```
+
+

Using beforeNotifyTopics:

-
{snippet:id=example4|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind.java}
-
+

+```xml
+START SNIPPET: example4 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind/java.java;hb=HEAD
+```
+
+

Using afterNotifyTopics and highlight:

-
{snippet:id=example5|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind.java}
-
+

+```xml
+START SNIPPET: example5 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind/java.java;hb=HEAD
+```
+
+

Using errorNotifyTopics and indicator:

-
{snippet:id=example6|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind.java}
-
+

+```xml
+START SNIPPET: example6 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind/java.java;hb=HEAD
+```
+
+

#####checkbox##### {#PAGE_14029}

@@ -305,20 +365,32 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Checkbox}
-
+
 Renders an HTML input element of type checkbox, populated by the specified property from the ValueStack.
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/checkbox.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/checkbox/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.Checkbox}
-
+

+```xml
+ JSP:
+ &lt;s:checkbox label="checkbox test" name="checkboxField1" value="aBoolean" fieldValue="true"/&gt;
+
+ Velocity:
+ #tag( Checkbox "label=checkbox test" "name=checkboxField1" "value=aBoolean" )
+
+ Resulting HTML (simple template, aBoolean == true):
+ &lt;input type="checkbox" name="checkboxField1" value="true" checked="checked" /&gt;
+
+```
+
+

#####checkboxlist##### {#PAGE_13969}

@@ -332,32 +404,34 @@ - - - - - - - - -
{snippet:id=javadocjavadoc=trueurl=org.apache.struts2.components.ListUIBean}
+

+ Note that the listkey and listvalue attribute will default to "key" and "value" + respectively only when the list attribute is evaluated to a Map or its descendant. + Everything else will result in listkey and listvalue to be null and not used. +

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.CheckboxList}
-
+

+ Creates a series of checkboxes from a list. Setup is like &lt;s:select /&gt; or &lt;s:radio /&gt;, but creates checkbox tags.
+
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/checkboxlist.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/checkboxlist/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.CheckboxList}
-
+

+```xml
+ &lt;s:checkboxlist name="foo" list="bar"/&gt;
+```
+
+

#####combobox##### {#PAGE_14259}

@@ -373,39 +447,118 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.ComboBox}
-
+
 <p>
+ The combo box is basically an HTML INPUT of type text and HTML SELECT grouped together to give you a combo box
+ functionality. You can place text in the INPUT control by using the SELECT control or type it in directly in
+ the text field.
+ </p>
+
+ <p>
+ In this example, the SELECT will be populated from id=year attribute. Counter is itself an Iterator. It will
+ span from first to last. The population is done via javascript, and requires that this tag be surrounded by a
+ &lt;form&gt;.
+ </p>
+
+ <p>
+ Note that unlike the &lt;s:select/&gt; tag, there is no ability to define the individual &lt;option&gt; tags' id attribute
+ or content separately. Each of these is simply populated from the toString() method of the list item. Presumably
+ this is because the select box isn't intended to actually submit useful data, but to assist the user in filling
+ out the text field.
+ </p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/combobox.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/combobox/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.ComboBox}
-
+

+```xml
+ JSP:
+ &lt;-- Example One --&gt;
+ &lt;s:bean name="struts.util.Counter" var="year"&gt;
+   &lt;s:param name="first" value="text('firstBirthYear')"/&gt;
+   &lt;s:param name="last" value="2000"/&gt;
+
+   &lt;s:combobox label="Birth year" size="6" maxlength="4" name="birthYear" list="#year"/&gt;
+ &lt;/s:bean&gt;
+
+ &lt;-- Example Two --&gt;
+ &lt;s:combobox
+     label="My Favourite Fruit"
+     name="myFavouriteFruit"
+     list="{'apple','banana','grape','pear'}"
+     headerKey="-1"
+     headerValue="--- Please Select ---"
+     emptyOption="true"
+     value="banana" /&gt;
+
+ &lt;-- Example Two --&gt;
+ &lt;s:combobox
+    label="My Favourite Color"
+    name="myFavouriteColor"
+    list="#{'red':'red','green':'green','blue':'blue'}"
+    headerKey="-1"
+    headerValue="--- Please Select ---"
+    emptyOption="true"
+    value="green" /&gt;
+
+ Velocity:
+ #tag( ComboBox "label=Birth year" "size=6" "maxlength=4" "name=birthYear" "list=#year" )
+```
+
+

#####component##### {#PAGE_14033}

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.GenericUIBean}
-
+
 <p>
+ Renders an custom UI widget using the specified templates. Additional objects can be passed in to the template
+ using the param tags.
+ </p>
+
+ <p><b>Freemarker:</b></p>
+ <pre>Objects provided can be retrieve from within the template via $parameters._paramname_.</pre>
+
+ <p><b>JSP:</b></p>
+ <pre>Objects provided can be retrieve from within the template via &lt;s:property value="%{parameters._paramname_}" /&gt;</pre>
+
+ <p>
+ In the bottom JSP and Velocity samples, two parameters are being passed in to the component. From within the
+ component, they can be accessed as:
+ </p>
+
+ <p><b>Freemarker:</b></p>
+ <pre>$parameters.get('key1') and $parameters.get('key2') or $parameters.key1 and $parameters.key2</pre>
+
+ <p><b>JSP:</b></p>
+ <pre>
+ &lt;s:property value="%{parameters.key1}" /&gt; and &lt;s:property value="%{'parameters.key2'}" /&gt; or
+ &lt;s:property value="%{parameters.get('key1')}" /&gt; and &lt;s:property value="%{parameters.get('key2')}" /&gt;
+ </pre>
+
+ <p>
+ Currently, your custom UI components can be written in Velocity, JSP, or Freemarker, and the correct rendering
+ engine will be found based on file extension.
+ </p>
+
+ <p>
+ <b>Remember:</b> the value params will always be resolved against the ValueStack so if you mean to pass a
+ string literal to your component, make sure to wrap it in single quotes i.e. value="'value1'" (note the opening "' and closing '" otherwise, the the value
+ stack will search for an Object on the stack with a method of getValue1().
+ </p>
+
- - - - - - - - -
{snippet:id=notejavadoc=trueurl=org.apache.struts2.components.GenericUIBean}
+

If Jsp is used as the template, the jsp template itself must lie within the + webapp itself and not the classpath. Unlike Freemarker or Velocity, JSP template + could not be picked up from the classpath.

(!) templateDir and theme attribute

@@ -439,14 +592,58 @@

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/component.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/component/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.GenericUIBean}
-
+

+```xml
+ <p>
+ JSP
+ </p>
+ <pre>
+     &lt;s:component template="/my/custom/component.vm"/&gt;
+
+       or
+
+     &lt;s:component template="/my/custom/component.vm"&gt;
+       &lt;s:param name="key1" value="value1"/&gt;
+       &lt;s:param name="key2" value="value2"/&gt;
+     &lt;/s:component&gt;
+ </pre>
+
+ <p>
+ Velocity
+ </p>
+ <pre>
+     #s-component( "template=/my/custom/component.vm" )
+
+       or
+
+     #s-component( "template=/my/custom/component.vm" )
+       #s-param( "name=key1" "value=value1" )
+       #s-param( "name=key2" "value=value2" )
+     #end
+ </pre>
+
+ <p>
+ Freemarker
+ </p>
+ <pre>
+    &lt;@s..component template="/my/custom/component.ftl" /&gt;
+
+      or
+
+    &lt;@s..component template="/my/custom/component.ftl"&gt;
+       &lt;@s..param name="key1" value="%{'value1'}" /&gt;
+       &lt;@s..param name="key2" value="%{'value2'}" /&gt;
+    &lt;/@s..component&gt;
+ </pre>
+```
+
+

#####datetextfield##### {#PAGE_40506485}

@@ -462,60 +659,76 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.DateTextField}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/org/apache/struts2/components/DateTextField.java;hb=HEAD
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/datetextfield.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/datetextfield/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.DateTextField}
-
+

+```xml
+START SNIPPET: example not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/org/apache/struts2/components/DateTextField.java;hb=HEAD
+```
+
+

#####datetimepicker##### {#PAGE_14274}

Description

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/DateTimePicker.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/DateTimePicker/java.java;hb=HEAD
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/datetimepicker.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/datetimepicker/html.java;hb=HEAD
+

Examples

-
{snippet:id=example1|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/DateTimePicker.java}
-
+

+```xml
+START SNIPPET: example1 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/DateTimePicker/java.java;hb=HEAD
+```
+
+

Getting and getting the datetimepicker value, from JavaScript:

-
{snippet:id=example2|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/DateTimePicker.java}
-
+

+```xml
+START SNIPPET: example2 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/DateTimePicker/java.java;hb=HEAD
+```
+
+

Publish topic when value changes

-
{snippet:id=example3|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/DateTimePicker.java}
-
+

+```xml
+START SNIPPET: example3 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/DateTimePicker/java.java;hb=HEAD
+```
+
+

#####div##### {#PAGE_13908}

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Div}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/org/apache/struts2/components/Div.java;hb=HEAD
+
@@ -535,60 +748,64 @@

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/div.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/div/html.java;hb=HEAD
+

#####dojo div##### {#PAGE_66929}

Description

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div/java.java;hb=HEAD
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/div.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/div/html.java;hb=HEAD
+

Examples

Simple div that loads its content once:

-
{snippet:id=example1|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java}
-
+

+```xml
+START SNIPPET: example1 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div/java.java;hb=HEAD
+```
+
+

div that reloads its content every 2 seconds, and shows an indicator while reloading:

-
{snippet:id=example2|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java}
-
+

+```xml
+START SNIPPET: example2 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div/java.java;hb=HEAD
+```
+
+

div that uses topics to control the timer, highlights its content in red after reload, and submits a form:

-
{snippet:id=example3|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java}
-
+

+```xml
+START SNIPPET: example3 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div/java.java;hb=HEAD
+```
+
+

#####dojo head##### {#PAGE_66757}

Description

-
- - - - - - - -
{snippet:id=noticejavadoc=trueurl=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java}
+

START SNIPPET: notice not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head/java.java;hb=HEAD

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head/java.java;hb=HEAD
+
@@ -609,32 +826,40 @@

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/head.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/head/html.java;hb=HEAD
+

Examples

-
{snippet:id=example1|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java}
-
+

+```xml
+START SNIPPET: example1 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head/java.java;hb=HEAD
+```
+
+
-
{snippet:id=example3|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java}
-
+

+```xml
+START SNIPPET: example3 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head/java.java;hb=HEAD
+```
+
+

#####dojo textarea##### {#PAGE_66931}

Description

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TextArea.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TextArea/java.java;hb=HEAD
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/textarea.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/textarea/html.java;hb=HEAD
+

#####doubleselect##### {#PAGE_14005}

@@ -648,56 +873,93 @@ - - - - - - - - -
{snippet:id=javadocjavadoc=trueurl=org.apache.struts2.components.DoubleListUIBean}
+

+ Note that the doublelistkey and doublelistvalue attribute will default to "key" and "value" + respectively only when the doublelist attribute is evaluated to a Map or its descendant. + Other thing else, will result in doublelistkey and doublelistvalue to be null and not used. +

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.DoubleSelect}
-
+
 Renders two HTML select elements with second one changing displayed values depending on selected entry of first one.
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/doubleselect.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/doubleselect/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.DoubleSelect}
-
+

+```xml
+ &lt;s:doubleselect label="doubleselect test1" name="menu" list="{'fruit','other'}" doubleName="dishes" doubleList="top == 'fruit' ? {'apple', 'orange'} : {'monkey', 'chicken'}" /&gt;
+ &lt;s:doubleselect label="doubleselect test2" name="menu" list="#{'fruit':'Nice Fruits', 'other':'Other Dishes'}" doubleName="dishes" doubleList="top == 'fruit' ? {'apple', 'orange'} : {'monkey', 'chicken'}" /&gt;
+```
+
+

#####fielderror##### {#PAGE_14151}

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.FieldError}
-
+

+ Render field errors if they exists. Specific layout depends on the particular theme.
+ The field error strings will be html escaped by default.
+
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/fielderror.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/fielderror/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.FieldError}
-
+

+```xml
+
+    &lt;!-- example 1 --&gt;
+    &lt;s:fielderror /&gt;
+
+    &lt;!-- example 2 --&gt;
+    &lt;s:fielderror&gt;
+         &lt;s:param&gt;field1&lt;/s:param&gt;
+         &lt;s:param&gt;field2&lt;/s:param&gt;
+    &lt;/s:fielderror&gt;
+    &lt;s:form .... &gt;
+       ....
+    &lt;/s:form&gt;
+
+    OR
+
+    &lt;s:fielderror&gt;
+          &lt;s:param value="%{'field1'}" /&gt;
+          &lt;s:param value="%{'field2'}" /&gt;
+    &lt;/s:fielderror&gt;
+    &lt;s:form .... &gt;
+       ....
+    &lt;/s:form&gt;
+
+    OR
+
+    &lt;s:fielderror fieldName="field1" /&gt;
+
+```
+
+
-
{snippet:id=description|javadoc=true|url=org.apache.struts2.components.FieldError}
-
+

+ Example 1: display all field errors<br>
+ Example 2: display field errors only for 'field1' and 'field2'<br>
+
+

#####file##### {#PAGE_14283}

@@ -713,20 +975,25 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.File}
-
+
 Renders an HTML file input element.
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/file.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/file/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.File}
-
+

+```xml
+ &lt;s:file name="anUploadFile" accept="text/*" /&gt;
+ &lt;s:file name="anohterUploadFIle" accept="text/html,text/plain" /&gt;
+```
+
+

#####form##### {#PAGE_14201}

@@ -742,20 +1009,54 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Form}
-
+
 <p>
+ Renders HTML an input form.
+ </p>
+
+ <p>
+ The remote form allows the form to be submitted without the page being refreshed. The results from the form
+ can be inserted into any HTML element on the page.
+ </p>
+ <p>
+ NOTE:<br>
+ The order / logic in determining the posting url of the generated HTML form is as follows:
+ </p>
+
+ <ol>
+ <li>
+ If the action attribute is not specified, then the current request will be used to
+ determine the posting url
+ </li>
+ <li>
+ If the action is given, Struts will try to obtain an ActionConfig. This will be
+ successful if the action attribute is a valid action alias defined struts.xml.
+ </li>
+ <li>
+ If the action is given and is not an action alias defined in struts.xml, Struts
+ will used the action attribute as if it is the posting url, separting the namespace
+ from it and using UrlHelper to generate the final url.
+ </li>
+ </ol>
+
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/form.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/form/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.Form}
-
+

+```xml
+
+ &lt;s:form ... /&gt;
+
+```
+
+

Validation

@@ -775,20 +1076,28 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Head}
-
+

+ Renders parts of the HEAD section for an HTML file. Encoding can be set using this tag.
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/head.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/head/html.java;hb=HEAD
+

Examples

-
{snippet:id=example1|lang=xml|javadoc=true|url=org.apache.struts2.components.Head}
-
+

+```xml
+ &lt;head&gt;
+   &lt;title&gt;My page&lt;/title&gt;
+   &lt;s:head/&gt;
+ &lt;/head&gt;
+```
+
+

#####hidden##### {#PAGE_14313}

@@ -804,50 +1113,75 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Hidden}
-
+
 Renders an HTML input element of type hidden, populated by the specified property from the ValueStack.
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/hidden.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/hidden/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.Hidden}
-
+

+```xml
+ &lt;-- example one --&gt;
+ &lt;s:hidden name="foo" /&gt;
+ &lt;-- example two --&gt;
+ &lt;s:hidden name="foo" value="%{bar}" /&gt;
+
+ Example One Resulting HTML (if foo evaluates to bar):
+ &lt;input type="hidden" name="foo" value="bar" /&gt;
+ Example Two Resulting HTML (if getBar method of the action returns 'bar')
+ &lt;input type="hidden" name="foo" value="bar" /&gt;
+```
+
+

#####inputtransferselect##### {#PAGE_17268774}

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.InputTransferSelect}
-
+
 <p>
+ Create a input transfer select component which is basically an text input
+ and  &lt;select ...&gt; tag with buttons in the middle of them allowing text
+ to be added to the transfer select. Will auto-select all its
+ elements upon its containing form submission.
+ </p>
+
- - - - - - - - -
{snippet:id=noticejavadoc=trueurl=org.apache.struts2.components.InputTransferSelect}
+

+ NOTE: The id and doubleId need not be supplied as they will generated provided + that the inputtransferselect tag is being used in a form tag. The generated id + and doubleId will be <form_id>_<inputtransferselect_doubleName> and + <form_id>_<inputtransferselect_doubleName> respectively. +

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/inputtransferselect.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/inputtransferselect/html.java;hb=HEAD
+

Example

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.InputTransferSelect}
-
+

+```xml
+
+ &lt;-- minimum configuration --&gt;
+ &lt;s:inputtransferselect
+      label="Favourite Cartoons Characters"
+      name="cartoons"
+      list="{'Popeye', 'He-Man', 'Spiderman'}"
+  /&gt;
+
+```
+
+

#####label##### {#PAGE_14167}

@@ -863,24 +1197,35 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Label}
-
+
 <p>Renders an HTML LABEL that will allow you to output label:name combination that has the same format treatment as
+ the rest of your UI controls.</p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/label.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/label/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.Label}
-
+

+```xml
+ &lt;s:label key="userName" /&gt;
+```
+
+
-
{snippet:id=exdescription|lang=none|javadoc=true|url=org.apache.struts2.components.Label}
-
+

+```none
+ <p>In this example, a label is rendered. The label is retrieved from a ResourceBundle via the key attribute
+ giving you an output of 'User Name: Ford.Prefect'. Assuming that i18n message userName corresponds
+ to 'User Name' and the action's getUserName() method returns 'Ford.Prefect'</p>
+```
+
+

#####optgroup##### {#PAGE_14170}

@@ -896,30 +1241,40 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.OptGroup}
-
+
 <p>
+ Create a optgroup component which needs to resides within a select tag.
+ </p>
+
- - - - - - - - -
{snippet:id=noticejavadoc=trueurl=org.apache.struts2.components.OptGroup}
+

+ This component is to be used within a Select component. +

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/optgroup.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/optgroup/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.OptGroup}
-
+

+```xml
+
+ &lt;s:select label="My Selection"
+            name="mySelection"
+            value="%{'POPEYE'}"
+            list="%{#{'SUPERMAN':'Superman', 'SPIDERMAN':'spiderman'}}"&gt;
+    &lt;s:optgroup label="Adult"
+                 list="%{#{'SOUTH_PARK':'South Park'}}" /&gt;
+    &lt;s:optgroup label="Japanese"
+                 list="%{#{'POKEMON':'pokemon','DIGIMON':'digimon','SAILORMOON':'Sailormoon'}}" /&gt;
+ &lt;/s:select&gt;
+
+```
+
+

#####optiontransferselect##### {#PAGE_13943}

@@ -933,36 +1288,75 @@ - - - - - - - - -
{snippet:id=javadocjavadoc=trueurl=org.apache.struts2.components.DoubleListUIBean}
+

+ Note that the doublelistkey and doublelistvalue attribute will default to "key" and "value" + respectively only when the doublelist attribute is evaluated to a Map or its descendant. + Other thing else, will result in doublelistkey and doublelistvalue to be null and not used. +

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.OptionTransferSelect}
-
+
 <p>
+ Create a option transfer select component which is basically two &lt;select ...&gt;
+ tag with buttons in the middle of them allowing options in each of the
+ &lt;select ...&gt; to be moved between themselves. Will auto-select all its
+ elements upon its containing form submision.
+ </p>
+
-
{snippet:id=notice|javadoc=true|url=org.apache.struts2.components.OptionTransferSelect}
-
+
 <p>
+ NOTE: The id and doubleId need not be supplied as they will generated provided
+ that the optiontransferselect tag is being used in a form tag. The generated id
+ and doubleId will be &lt;form_id&gt;_&lt;optiontransferselect_nameame&gt; and
+ &lt;form_id&gt;_&lt;optiontransferselect_doubleName&gt; respectively.
+ </p>
+
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/optiontransferselect.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/optiontransferselect/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.OptionTransferSelect}
-
+

+```xml
+
+ &lt;-- minimum configuration --&gt;
+ &lt;s:optiontransferselect
+      label="Favourite Cartoons Characters"
+      name="leftSideCartoonCharacters"
+      list="{'Popeye', 'He-Man', 'Spiderman'}"
+      doubleName="rightSideCartoonCharacters"
+      doubleList="{'Superman', 'Mickey Mouse', 'Donald Duck'}"
+  /&gt;
+
+  &lt;-- possible configuration --&gt;
+  &lt;s:optiontransferselect
+      label="Favourite Cartoons Characters"
+      name="leftSideCartoonCharacters"
+      leftTitle="Left Title"
+      rightTitle="Right Title"
+      list="{'Popeye', 'He-Man', 'Spiderman'}"
+      multiple="true"
+      headerKey="headerKey"
+      headerValue="--- Please Select ---"
+      emptyOption="true"
+      doubleList="{'Superman', 'Mickey Mouse', 'Donald Duck'}"
+      doubleName="rightSideCartoonCharacters"
+      doubleHeaderKey="doubleHeaderKey"
+      doubleHeaderValue="--- Please Select ---"
+      doubleEmptyOption="true"
+      doubleMultiple="true"
+  /&gt;
+
+```
+
+

#####password##### {#PAGE_13826}

@@ -978,24 +1372,35 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Password}
-
+
 <p>Render an HTML input tag of type password.</p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/password.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/password/html.java;hb=HEAD
+

Examples

-
{snippet:id=exdescription|javadoc=true|lang=none|url=org.apache.struts2.components.Password}
-
+

+```none
+ <p>
+ In this example, a password control is displayed. For the label, we are calling ActionSupport's getText() to
+ retrieve password label from a resource bundle.
+ </p>
+```
+
+
-
{snippet:id=example|javadoc=true|lang=xml|url=org.apache.struts2.components.Password}
-
+

+```xml
+ &lt;s:password label="%{text('password')}" name="password" size="10" maxlength="15" /&gt;
+```
+
+

#####radio##### {#PAGE_14226}

@@ -1009,40 +1414,49 @@ - - - - - - - - -
{snippet:id=javadocjavadoc=trueurl=org.apache.struts2.components.ListUIBean}
+

+ Note that the listkey and listvalue attribute will default to "key" and "value" + respectively only when the list attribute is evaluated to a Map or its descendant. + Everything else will result in listkey and listvalue to be null and not used. +

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Radio}
-
+
 <p>Render a radio button input field.</p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/radio.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/radio/html.java;hb=HEAD
+

Examples

-
{snippet:id=exdescription|javadoc=true|url=org.apache.struts2.components.Radio}
-
+
 In this example, a radio control is displayed with a list of genders. The gender list is built from attribute
+ id=genders. The framework calls getGenders() which will return a Map. For examples using listKey and listValue attributes,
+ see the section select tag. The default selected one will be determined (in this case) by the getMale() method
+ in the action class which should return a value similar to the key of the getGenders() map if that particular
+ gender is to be selected.
+
-
{snippet:id=example|javadoc=true|lang=xml|url=org.apache.struts2.components.Radio}
-
+

+```xml
+ &lt;s:action name="GenderMap" var="genders"/&gt;
+ &lt;s:radio label="Gender" name="male" list="#genders.genders"/&gt;
+```
+
+
-
{snippet:id=example_fmt|javadoc=true|lang=xml|url=org.apache.struts2.components.Radio}
-
+

+```xml
+ &lt;@s.radio name="car" list={"ford": "Ford Motor Co", "toyota": "Toyota"} listKey="key" listValue="value" /&gt;
+```
+
+

#####reset##### {#PAGE_13833}

@@ -1058,28 +1472,44 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Reset}
-
+
 Render a reset button. The reset tag is used together with the form tag to provide form resetting.
+ The reset can have two different types of rendering:
+ <ul>
+ <li>input: renders as html &lt;input type="reset"...&gt;</li>
+ <li>button: renders as html &lt;button type="reset"...&gt;</li>
+ </ul>
+ Please note that the button type has advantages by adding the possibility to separate the submitted value from the
+ text shown on the button face, but has issues with Microsoft Internet Explorer at least up to 6.0
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/reset.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/reset/html.java;hb=HEAD
+

Examples

Example 1

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.Reset}
-
+

+```xml
+ &lt;s:reset value="Reset" /&gt;
+```
+
+

Example 2

-
{snippet:id=example2|lang=xml|javadoc=true|url=org.apache.struts2.components.Reset}
-
+

+```xml
+ Render a reset button:
+ &lt;s:reset type="button" key="reset"/&gt;
+```
+
+

#####select##### {#PAGE_14127}

@@ -1095,24 +1525,63 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Select}
-
+

+ Render an HTML input tag of type select.
+
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/select.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/select/html.java;hb=HEAD
+

Examples

-
{snippet:id=exnote|javadoc=true|lang=none|url=org.apache.struts2.components.Select}
-
+

+```none
+
+ Note: For any of the tags that use lists (select probably being the most ubiquitous), which uses the OGNL list
+ notation (see the "months" example above), it should be noted that the map key created (in the months example,
+ the '01', '02', etc.) is typed. '1' is a char, '01' is a String, "1" is a String. This is important since if
+ the value returned by your "value" attribute is NOT the same type as the key in the "list" attribute, they
+ WILL NOT MATCH, even though their String values may be equivalent. If they don't match, nothing in your list
+ will be auto-selected.
+
+```
+
+
-
{snippet:id=example|javadoc=true|lang=xml|url=org.apache.struts2.components.Select}
-
+

+```xml
+
+ &lt;s:select label="Pets"
+        name="petIds"
+        list="petDao.pets"
+        listKey="id"
+        listValue="name"
+        multiple="true"
+        size="3"
+        required="true"
+        value="%{petDao.pets.{id}}"
+ /&gt;
+
+ &lt;s:select label="Months"
+        name="months"
+        headerKey="-1" headerValue="Select Month"
+        list="#{'01':'Jan', '02':'Feb', [...]}"
+        value="selectedMonth"
+        required="true"
+ /&gt;
+
+ // The month id (01, 02, ...) returned by the getSelectedMonth() call
+ // against the stack will be auto-selected
+
+```
+
+

#####submit##### {#PAGE_14054}

@@ -1128,8 +1597,16 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Submit}
-
+
 Render a submit button. The submit tag is used together with the form tag to provide asynchronous form submissions.
+ The submit can have three different types of rendering:
+ <ul>
+ <li>input: renders as html &lt;input type="submit"...&gt;</li>
+ <li>image: renders as html &lt;input type="image"...&gt;</li>
+ <li>button: renders as html &lt;button type="submit"...&gt;</li>
+ </ul>
+ Please note that the button type has advantages by adding the possibility to seperate the submitted value from the
+ text shown on the button face, but has issues with Microsoft Internet Explorer at least up to 6.0
+
@@ -1158,36 +1635,44 @@

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/submit.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/submit/html.java;hb=HEAD
+

#####tabbedPanel##### {#PAGE_14222}

Description

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TabbedPanel.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TabbedPanel/java.java;hb=HEAD
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/a.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/a/html.java;hb=HEAD
+

Examples

The following is an example of a tabbedpanel and panel tag utilizing local and remote content:

-
{snippet:id=example1|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TabbedPanel.java}
-
+

+```xml
+START SNIPPET: example1 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TabbedPanel/java.java;hb=HEAD
+```
+
+

Use notify topics to prevent a tab from being selected:

-
{snippet:id=example2|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TabbedPanel.java}
-
+

+```xml
+START SNIPPET: example2 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TabbedPanel/java.java;hb=HEAD
+```
+
+

#####textarea##### {#PAGE_13926}

@@ -1203,20 +1688,24 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.TextArea}
-
+
 <p>Render HTML textarea tag.</p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/textarea.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/textarea/html.java;hb=HEAD
+

Example

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.TextArea}
-
+

+```xml
+ &lt;s:textarea label="Comments" name="comments" cols="30" rows="8"/&gt;
+```
+
+

#####textfield##### {#PAGE_13912}

@@ -1232,24 +1721,32 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.TextField}
-
+
 <p>Render an HTML input field of type text</p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/textfield.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/textfield/html.java;hb=HEAD
+

Examples

-
{snippet:id=exdescription|lang=none|javadoc=true|url=org.apache.struts2.components.TextField}
-
+

+```none
+ In this example, a text control for the "user" property is rendered. The label is also retrieved from a ResourceBundle via the key attribute.
+```
+
+
-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.TextField}
-
+

+```xml
+ &lt;s:textfield key="user" /&gt;
+```
+
+

#####token##### {#PAGE_13998}

@@ -1265,76 +1762,101 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Token}
-
+
 <p>Stop double-submission of forms.</p>
+
+ <p>
+ The token tag is used to help with the "double click" submission problem. It is needed if you are using the
+ TokenInterceptor or the TokenSessionInterceptor. The s:token tag merely places a hidden element that contains
+ the unique token.</p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/token.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/token/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|javadoc=true|lang=xml|url=org.apache.struts2.components.Token}
-
+

+```xml
+ &lt;s:token /&gt;
+```
+
+

#####tree##### {#PAGE_14168}

Description

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree/java.java;hb=HEAD
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/tree.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/tree/html.java;hb=HEAD
+

Examples

Static tree:

-
{snippet:id=example1|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree.java}
-
+

+```xml
+START SNIPPET: example1 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree/java.java;hb=HEAD
+```
+
+

Dynamic tree (rendered on the server):

-
{snippet:id=example2|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree.java}
-
+

+```xml
+START SNIPPET: example2 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree/java.java;hb=HEAD
+```
+
+

Dynamic tree loaded with AJAX (one request is made for each node):

-
{snippet:id=example3|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree.java}
-
+

+```xml
+START SNIPPET: example3 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree/java.java;hb=HEAD
+```
+
+

#####treenode##### {#PAGE_14288}

Description

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TreeNode.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TreeNode/java.java;hb=HEAD
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/treenode.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/treenode/html.java;hb=HEAD
+

Examples

Update target content with html returned from an action:

-
{snippet:id=example|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TreeNode.java}
-
+

+```xml
+START SNIPPET: example not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TreeNode/java.java;hb=HEAD
+```
+
+

#####updownselect##### {#PAGE_13884}

@@ -1348,40 +1870,66 @@
- - - - - - - - -
{snippet:id=javadocjavadoc=trueurl=org.apache.struts2.components.ListUIBean}
+

+ Note that the listkey and listvalue attribute will default to "key" and "value" + respectively only when the list attribute is evaluated to a Map or its descendant. + Everything else will result in listkey and listvalue to be null and not used. +

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.UpDownSelect}
-
+
 <p>
+ Create a Select component with buttons to move the elements in the select component
+ up and down. When the containing form is submited, its elements will be submitted in
+ the order they are arranged (top to bottom).
+ </p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/updownselect.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/updownselect/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.UpDownSelect}
-
+

+```xml
+
+ &lt;!-- Example 1: simple example --&gt;
+ &lt;s:updownselect
+ list="#{'england':'England', 'america':'America', 'germany':'Germany'}"
+ name="prioritisedFavouriteCountries"
+ headerKey="-1"
+ headerValue="--- Please Order Them Accordingly ---"
+ emptyOption="true" /&gt;
+
+ &lt;!-- Example 2: more complex example --&gt;
+ &lt;s:updownselect
+ list="defaultFavouriteCartoonCharacters"
+ name="prioritisedFavouriteCartoonCharacters"
+ headerKey="-1"
+ headerValue="--- Please Order ---"
+ emptyOption="true"
+ allowMoveUp="true"
+ allowMoveDown="true"
+ allowSelectAll="true"
+ moveUpLabel="Move Up"
+ moveDownLabel="Move Down"
+ selectAllLabel="Select All" /&gt;
+
+```
+
+

####dojo anchor#### {#PAGE_66791}

Description

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor/java.java;hb=HEAD
+

There’s a bug in IE6/IE7 which makes impossible to use the target’s attribute with a parent Div, because such Div’s content’s are overwritten with the tag’s loadingText . Resulting in an “undefined” message in the content’s, instead of the result of the request.

@@ -1401,54 +1949,78 @@

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/a.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/a/html.java;hb=HEAD
+

Examples

Update target content with html returned from an action:

-
{snippet:id=example1|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java}
-
+

+```xml
+START SNIPPET: example1 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor/java.java;hb=HEAD
+```
+
+

Submit form(anchor inside the form):

-
{snippet:id=example2|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java}
-
+

+```xml
+START SNIPPET: example2 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor/java.java;hb=HEAD
+```
+
+

Submit form(anchor outside the form):

-
{snippet:id=example3|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java}
-
+

+```xml
+START SNIPPET: example3 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor/java.java;hb=HEAD
+```
+
+

Using beforeNotifyTopics:

-
{snippet:id=example4|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java}
-
+

+```xml
+START SNIPPET: example4 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor/java.java;hb=HEAD
+```
+
+

Using afterNotifyTopics and highlights target:

-
{snippet:id=example5|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java}
-
+

+```xml
+START SNIPPET: example5 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor/java.java;hb=HEAD
+```
+
+

Using errorNotifyTopics and indicator:

-
{snippet:id=example6|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java}
-
+

+```xml
+START SNIPPET: example6 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor/java.java;hb=HEAD
+```
+
+

####dojo submit#### {#PAGE_66801}

Description

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit/java.java;hb=HEAD
+

There’s a bug in IE6/IE7 which makes impossible to use the target’s attribute with a parent Div, because such Div’s content’s are overwritten with the tag’s loadingText . Resulting in an “undefined” message in the content’s, instead of the result of the request.

@@ -1468,62 +2040,98 @@

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/submit.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/submit/html.java;hb=HEAD
+

Examples

-
{snippet:id=example1|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java}
-
+

+```xml
+START SNIPPET: example1 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit/java.java;hb=HEAD
+```
+
+

Render an image submit:

-
{snippet:id=example2|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java}
-
+

+```xml
+START SNIPPET: example2 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit/java.java;hb=HEAD
+```
+
+

Render a button submit:

-
{snippet:id=example3|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java}
-
+

+```xml
+START SNIPPET: example3 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit/java.java;hb=HEAD
+```
+
+

Update target content with html returned from an action:

-
{snippet:id=example4|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java}
-
+

+```xml
+START SNIPPET: example4 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit/java.java;hb=HEAD
+```
+
+

Submit form(inside the form):

-
{snippet:id=example5|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java}
-
+

+```xml
+START SNIPPET: example5 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit/java.java;hb=HEAD
+```
+
+

Submit form(outside the form):

-
{snippet:id=example6|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java}
-
+

+```xml
+START SNIPPET: example6 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit/java.java;hb=HEAD
+```
+
+

Using beforeNotifyTopics:

-
{snippet:id=example7|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java}
-
+

+```xml
+START SNIPPET: example7 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit/java.java;hb=HEAD
+```
+
+

Using afterNotifyTopics and highlight target:

-
{snippet:id=example8|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java}
-
+

+```xml
+START SNIPPET: example8 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit/java.java;hb=HEAD
+```
+
+

Using errorNotifyTopics and indicator:

-
{snippet:id=example9|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java}
-
+

+```xml
+START SNIPPET: example9 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit/java.java;hb=HEAD
+```
+
+
diff --git a/content/tag-developers/append-tag.html b/content/tag-developers/append-tag.html index e47393a..eab1fcf 100644 --- a/content/tag-developers/append-tag.html +++ b/content/tag-developers/append-tag.html @@ -133,24 +133,86 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.AppendIterator}
-
+
 <p>Component for AppendIteratorTag, which jobs is to append iterators to form an
+ appended iterator whereby entries goes from one iterator to another after each
+ respective iterator is exhausted of entries.</p>
+
+ <p>For example, if there are 3 iterator appended (each iterator has 3 entries),
+ the following will be how the appended iterator entries will be arranged:</p>
+
+ <ol>
+      <li>First Entry of the First Iterator</li>
+      <li>Second Entry of the First Iterator</li>
+      <li>Third Entry of the First Iterator</li>
+      <li>First Entry of the Second Iterator</li>
+      <li>Second Entry of the Second Iterator</li>
+      <li>Third Entry of the Second Iterator</li>
+      <li>First Entry of the Third Iterator</li>
+      <li>Second Entry of the Third Iterator</li>
+      <li>Third Entry of the Third ITerator</li>
+ </ol>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/append.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/append/html.java;hb=HEAD
+

Example

-
{snippet:id=code|lang=java|javadoc=true|url=org.apache.struts2.components.AppendIterator}
-
+

+```java
+ public class AppendIteratorTagAction extends ActionSupport {
+
+  private List myList1;
+  private List myList2;
+  private List myList3;
+
+
+  public String execute() throws Exception {
+
+      myList1 = new ArrayList();
+      myList1.add("1");
+      myList1.add("2");
+      myList1.add("3");
+
+      myList2 = new ArrayList();
+      myList2.add("a");
+      myList2.add("b");
+      myList2.add("c");
+
+      myList3 = new ArrayList();
+      myList3.add("A");
+      myList3.add("B");
+      myList3.add("C");
+
+      return "done";
+  }
+
+  public List getMyList1() { return myList1; }
+  public List getMyList2() { return myList2; }
+  public List getMyList3() { return myList3; }
+}
+```
+
+
-
{snippet:id=example|javadoc=true|lang=xml|url=org.apache.struts2.components.AppendIterator}
-
+

+```xml
+ &lt;s:append var="myAppendIterator"&gt;
+      &lt;s:param value="%{myList1}" /&gt;
+      &lt;s:param value="%{myList2}" /&gt;
+      &lt;s:param value="%{myList3}" /&gt;
+ &lt;/s:append&gt;
+ &lt;s:iterator value="%{#myAppendIterator}"&gt;
+      &lt;s:property /&gt;
+ &lt;/s:iterator&gt;
+```
+
+
diff --git a/content/tag-developers/bean-tag.html b/content/tag-developers/bean-tag.html index 6101f46..2339dc4 100644 --- a/content/tag-developers/bean-tag.html +++ b/content/tag-developers/bean-tag.html @@ -133,24 +133,59 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Bean}
-
+
 <p>Instantiates a class that conforms to the JavaBeans specification. This tag has a body which can contain
+ a number of {@link Param} elements to set any mutator methods on that class.</p>
+
+ <p>If the var attribute is set on the BeanTag, it will place the instantiated bean into the
+ stack's Context.</p>
+
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/bean.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/bean/html.java;hb=HEAD
+

Examples

-
{snippet:id=examples|javadoc=true|lang=xml|url=org.apache.struts2.components.Bean}
-
+

+```xml
+ &lt;-- in freemarker form --&gt;
+ [@s.bean name="org.apache.struts2.example.counter.SimpleCounter" var="counter"]
+   [s:param name="foo" value="BAR"/]
+   The value of foo is : [s:property value="foo"/], when inside the bean tag.
+ [/s:bean]
+
+ &lt;-- in jsp form --&gt;
+ &lt;s:bean name="org.apache.struts2.example.counter.SimpleCounter" var="counter"&gt;
+   &lt;s:param name="foo" value="BAR" /&gt;
+   The value of foot is : &lt;s:property value="foo"/&gt;, when inside the bean tag &lt;br /&gt;
+ &lt;/s:bean&gt;
+```
+
+
-
{snippet:id=examplesdescription|javadoc=true|url=org.apache.struts2.components.Bean}
-
+
 <p>This example instantiates a bean called SimpleCounter and sets the foo property (setFoo('BAR')). The
+ SimpleCounter object is then pushed onto the Valuestack, which means that we can call its accessor methods (getFoo())
+ with the Property tag and get their values.</p>
+
+ <p>In the above example, the id has been set to a value of <i>counter</i>. This means that the SimpleCounter class
+ will be placed into the stack's context. You can access the SimpleCounter class using a Struts tag:</p>
+
+ <pre>
+ &lt;-- jsp form --&gt;
+ &lt;s:property value="#counter" /&gt;
+
+ &lt;-- freemarker form --&gt;
+ [s:property value="#counter.foo"/]
+ </pre>
+
+ <p>In the property tag example, the <i>#</i> tells Ognl to search the context for the SimpleCounter class which has
+ an id(key) of <i>counter</i></p>
+
diff --git a/content/tag-developers/checkbox-tag.html b/content/tag-developers/checkbox-tag.html index 3ab299d..56689b3 100644 --- a/content/tag-developers/checkbox-tag.html +++ b/content/tag-developers/checkbox-tag.html @@ -140,20 +140,32 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Checkbox}
-
+
 Renders an HTML input element of type checkbox, populated by the specified property from the ValueStack.
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/checkbox.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/checkbox/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.Checkbox}
-
+

+```xml
+ JSP:
+ &lt;s:checkbox label="checkbox test" name="checkboxField1" value="aBoolean" fieldValue="true"/&gt;
+
+ Velocity:
+ #tag( Checkbox "label=checkbox test" "name=checkboxField1" "value=aBoolean" )
+
+ Resulting HTML (simple template, aBoolean == true):
+ &lt;input type="checkbox" name="checkboxField1" value="true" checked="checked" /&gt;
+
+```
+
+
diff --git a/content/tag-developers/checkboxlist-tag.html b/content/tag-developers/checkboxlist-tag.html index ee01628..43d6728 100644 --- a/content/tag-developers/checkboxlist-tag.html +++ b/content/tag-developers/checkboxlist-tag.html @@ -138,32 +138,34 @@ - - - - - - - - -
{snippet:id=javadocjavadoc=trueurl=org.apache.struts2.components.ListUIBean}
+

+ Note that the listkey and listvalue attribute will default to "key" and "value" + respectively only when the list attribute is evaluated to a Map or its descendant. + Everything else will result in listkey and listvalue to be null and not used. +

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.CheckboxList}
-
+

+ Creates a series of checkboxes from a list. Setup is like &lt;s:select /&gt; or &lt;s:radio /&gt;, but creates checkbox tags.
+
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/checkboxlist.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/checkboxlist/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.CheckboxList}
-
+

+```xml
+ &lt;s:checkboxlist name="foo" list="bar"/&gt;
+```
+
+
diff --git a/content/tag-developers/combobox-tag.html b/content/tag-developers/combobox-tag.html index 0462cee..2bf8bb0 100644 --- a/content/tag-developers/combobox-tag.html +++ b/content/tag-developers/combobox-tag.html @@ -140,20 +140,71 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.ComboBox}
-
+
 <p>
+ The combo box is basically an HTML INPUT of type text and HTML SELECT grouped together to give you a combo box
+ functionality. You can place text in the INPUT control by using the SELECT control or type it in directly in
+ the text field.
+ </p>
+
+ <p>
+ In this example, the SELECT will be populated from id=year attribute. Counter is itself an Iterator. It will
+ span from first to last. The population is done via javascript, and requires that this tag be surrounded by a
+ &lt;form&gt;.
+ </p>
+
+ <p>
+ Note that unlike the &lt;s:select/&gt; tag, there is no ability to define the individual &lt;option&gt; tags' id attribute
+ or content separately. Each of these is simply populated from the toString() method of the list item. Presumably
+ this is because the select box isn't intended to actually submit useful data, but to assist the user in filling
+ out the text field.
+ </p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/combobox.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/combobox/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.ComboBox}
-
+

+```xml
+ JSP:
+ &lt;-- Example One --&gt;
+ &lt;s:bean name="struts.util.Counter" var="year"&gt;
+   &lt;s:param name="first" value="text('firstBirthYear')"/&gt;
+   &lt;s:param name="last" value="2000"/&gt;
+
+   &lt;s:combobox label="Birth year" size="6" maxlength="4" name="birthYear" list="#year"/&gt;
+ &lt;/s:bean&gt;
+
+ &lt;-- Example Two --&gt;
+ &lt;s:combobox
+     label="My Favourite Fruit"
+     name="myFavouriteFruit"
+     list="{'apple','banana','grape','pear'}"
+     headerKey="-1"
+     headerValue="--- Please Select ---"
+     emptyOption="true"
+     value="banana" /&gt;
+
+ &lt;-- Example Two --&gt;
+ &lt;s:combobox
+    label="My Favourite Color"
+    name="myFavouriteColor"
+    list="#{'red':'red','green':'green','blue':'blue'}"
+    headerKey="-1"
+    headerValue="--- Please Select ---"
+    emptyOption="true"
+    value="green" /&gt;
+
+ Velocity:
+ #tag( ComboBox "label=Birth year" "size=6" "maxlength=4" "name=birthYear" "list=#year" )
+```
+
+
diff --git a/content/tag-developers/component-tag.html b/content/tag-developers/component-tag.html index 9976bf5..aa86c4d 100644 --- a/content/tag-developers/component-tag.html +++ b/content/tag-developers/component-tag.html @@ -131,19 +131,47 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.GenericUIBean}
-
+
 <p>
+ Renders an custom UI widget using the specified templates. Additional objects can be passed in to the template
+ using the param tags.
+ </p>
+
+ <p><b>Freemarker:</b></p>
+ <pre>Objects provided can be retrieve from within the template via $parameters._paramname_.</pre>
+
+ <p><b>JSP:</b></p>
+ <pre>Objects provided can be retrieve from within the template via &lt;s:property value="%{parameters._paramname_}" /&gt;</pre>
+
+ <p>
+ In the bottom JSP and Velocity samples, two parameters are being passed in to the component. From within the
+ component, they can be accessed as:
+ </p>
+
+ <p><b>Freemarker:</b></p>
+ <pre>$parameters.get('key1') and $parameters.get('key2') or $parameters.key1 and $parameters.key2</pre>
+
+ <p><b>JSP:</b></p>
+ <pre>
+ &lt;s:property value="%{parameters.key1}" /&gt; and &lt;s:property value="%{'parameters.key2'}" /&gt; or
+ &lt;s:property value="%{parameters.get('key1')}" /&gt; and &lt;s:property value="%{parameters.get('key2')}" /&gt;
+ </pre>
+
+ <p>
+ Currently, your custom UI components can be written in Velocity, JSP, or Freemarker, and the correct rendering
+ engine will be found based on file extension.
+ </p>
+
+ <p>
+ <b>Remember:</b> the value params will always be resolved against the ValueStack so if you mean to pass a
+ string literal to your component, make sure to wrap it in single quotes i.e. value="'value1'" (note the opening "' and closing '" otherwise, the the value
+ stack will search for an Object on the stack with a method of getValue1().
+ </p>
+
- - - - - - - - -
{snippet:id=notejavadoc=trueurl=org.apache.struts2.components.GenericUIBean}
+

If Jsp is used as the template, the jsp template itself must lie within the + webapp itself and not the classpath. Unlike Freemarker or Velocity, JSP template + could not be picked up from the classpath.

(!) templateDir and theme attribute

@@ -177,14 +205,58 @@

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/component.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/component/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.GenericUIBean}
-
+

+```xml
+ <p>
+ JSP
+ </p>
+ <pre>
+     &lt;s:component template="/my/custom/component.vm"/&gt;
+
+       or
+
+     &lt;s:component template="/my/custom/component.vm"&gt;
+       &lt;s:param name="key1" value="value1"/&gt;
+       &lt;s:param name="key2" value="value2"/&gt;
+     &lt;/s:component&gt;
+ </pre>
+
+ <p>
+ Velocity
+ </p>
+ <pre>
+     #s-component( "template=/my/custom/component.vm" )
+
+       or
+
+     #s-component( "template=/my/custom/component.vm" )
+       #s-param( "name=key1" "value=value1" )
+       #s-param( "name=key2" "value=value2" )
+     #end
+ </pre>
+
+ <p>
+ Freemarker
+ </p>
+ <pre>
+    &lt;@s..component template="/my/custom/component.ftl" /&gt;
+
+      or
+
+    &lt;@s..component template="/my/custom/component.ftl"&gt;
+       &lt;@s..param name="key1" value="%{'value1'}" /&gt;
+       &lt;@s..param name="key2" value="%{'value2'}" /&gt;
+    &lt;/@s..component&gt;
+ </pre>
+```
+
+
diff --git a/content/tag-developers/date-tag.html b/content/tag-developers/date-tag.html index 054297d..07d76a3 100644 --- a/content/tag-developers/date-tag.html +++ b/content/tag-developers/date-tag.html @@ -131,20 +131,118 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Date}
-
+

+ Format Date object in different ways.
+ <p>
+ The date tag will allow you to format a Date in a quick and easy way.
+ You can specify a <b>custom format</b> (eg. "dd/MM/yyyy hh:mm"), you can generate
+ <b>easy readable notations</b> (like "in 2 hours, 14 minutes"), or you can just fall back
+ on a <b>predefined format</b> with key 'struts.date.format' in your properties file.
+ </p>
+
+ <p>
+ If that key is not defined, it will finally fall back to the default DateFormat.MEDIUM
+ formatting.
+ </p>
+
+ <p>
+ <b>Note</b>: If the requested Date object isn't found on the stack, a blank will be returned.
+ </p>
+
+ <p>
+ Configurable attributes are:
+ </p>
+
+ <ul>
+    <li>name</li>
+    <li>nice</li>
+    <li>format</li>
+ </ul>
+
+ <p>
+ Following how the date component will work, depending on the value of nice attribute
+ (which by default is false) and the format attribute.
+ </p>
+
+ <p>
+ <b><u>Condition 1: With nice attribute as true</u></b>
+ </p>
+ <table border="1" summary="">
+   <tr>
+      <td>i18n key</td>
+      <td>default</td>
+   </tr>
+   <tr>
+      <td>struts.date.format.past</td>
+      <td>&#x7b;0&#x7d; ago</td>
+   </tr>
+   <tr>
+      <td>struts.date.format.future</td>
+      <td>in &#x7b;0&#x7d;</td>
+   </tr>
+   <tr>
+      <td>struts.date.format.seconds</td>
+      <td>an instant</td>
+   </tr>
+   <tr>
+      <td>struts.date.format.minutes</td>
+      <td>&#x7b;0,choice,1#one minute|1&lt;&#x7b;0&#x7d; minutes&#x7d;</td>
+   </tr>
+   <tr>
+      <td>struts.date.format.hours</td>
+      <td>&#x7b;0,choice,1#one hour|1&lt;&#x7b;0&#x7d; hours&#x7d;&#x7b;1,choice,0#|1#, one minute|1&lt;, &#x7b;1&#x7d; minutes&#x7d;</td>
+   </tr>
+   <tr>
+      <td>struts.date.format.days</td>
+      <td>&#x7b;0,choice,1#one day|1&lt;&#x7b;0&#x7d; days&#x7d;&#x7b;1,choice,0#|1#, one hour|1&lt;, &#x7b;1&#x7d; hours&#x7d;</td>
+   </tr>
+   <tr>
+      <td>struts.date.format.years</td>
+      <td>&#x7b;0,choice,1#one year|1&lt;&#x7b;0&#x7d; years&#x7d;&#x7b;1,choice,0#|1#, one day|1&lt;, &#x7b;1&#x7d; days&#x7d;</td>
+   </tr>
+ </table>
+
+ <p>
+ <b><u>Condition 2: With nice attribute as false and format attribute is specified eg. dd/MM/yyyyy </u></b>
+ </p>
+
+ <p>In this case the format attribute will be used.</p>
+
+ <p>
+ <b><u>Condition 3: With nice attribute as false and no format attribute is specified </u></b>
+ </p>
+ <table border="1" summary="">
+    <tr>
+      <td>i18n key</td>
+      <td>default</td>
+   </tr>
+   <tr>
+      <td>struts.date.format</td>
+      <td>if one is not found DateFormat.MEDIUM format will be used</td>
+   </tr>
+ </table>
+
+
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/date.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/date/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.Date}
-
+

+```xml
+  &lt;s:date name="person.birthday" format="dd/MM/yyyy" /&gt;
+  &lt;s:date name="person.birthday" format="%{getText('some.i18n.key')}" /&gt;
+  &lt;s:date name="person.birthday" nice="true" /&gt;
+  &lt;s:date name="person.birthday" /&gt;
+```
+
+
diff --git a/content/tag-developers/datetextfield-tag.html b/content/tag-developers/datetextfield-tag.html index 17f09bb..fb27d0b 100644 --- a/content/tag-developers/datetextfield-tag.html +++ b/content/tag-developers/datetextfield-tag.html @@ -140,20 +140,24 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.DateTextField}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/org/apache/struts2/components/DateTextField.java;hb=HEAD
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/datetextfield.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/datetextfield/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.DateTextField}
-
+

+```xml
+START SNIPPET: example not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/org/apache/struts2/components/DateTextField.java;hb=HEAD
+```
+
+
diff --git a/content/tag-developers/div-tag.html b/content/tag-developers/div-tag.html index 400f32f..68e11ba 100644 --- a/content/tag-developers/div-tag.html +++ b/content/tag-developers/div-tag.html @@ -131,8 +131,8 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Div}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/org/apache/struts2/components/Div.java;hb=HEAD
+
@@ -152,8 +152,8 @@

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/div.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/div/html.java;hb=HEAD
+
diff --git a/content/tag-developers/dojo-a-tag.html b/content/tag-developers/dojo-a-tag.html index 21f5cae..9043211 100644 --- a/content/tag-developers/dojo-a-tag.html +++ b/content/tag-developers/dojo-a-tag.html @@ -131,8 +131,8 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor/java.java;hb=HEAD
+

There’s a bug in IE6/IE7 which makes impossible to use the target’s attribute with a parent Div, because such Div’s content’s are overwritten with the tag’s loadingText . Resulting in an “undefined” message in the content’s, instead of the result of the request.

@@ -152,46 +152,70 @@

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/a.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/a/html.java;hb=HEAD
+

Examples

Update target content with html returned from an action:

-
{snippet:id=example1|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java}
-
+

+```xml
+START SNIPPET: example1 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor/java.java;hb=HEAD
+```
+
+

Submit form(anchor inside the form):

-
{snippet:id=example2|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java}
-
+

+```xml
+START SNIPPET: example2 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor/java.java;hb=HEAD
+```
+
+

Submit form(anchor outside the form):

-
{snippet:id=example3|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java}
-
+

+```xml
+START SNIPPET: example3 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor/java.java;hb=HEAD
+```
+
+

Using beforeNotifyTopics:

-
{snippet:id=example4|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java}
-
+

+```xml
+START SNIPPET: example4 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor/java.java;hb=HEAD
+```
+
+

Using afterNotifyTopics and highlights target:

-
{snippet:id=example5|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java}
-
+

+```xml
+START SNIPPET: example5 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor/java.java;hb=HEAD
+```
+
+

Using errorNotifyTopics and indicator:

-
{snippet:id=example6|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java}
-
+

+```xml
+START SNIPPET: example6 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor/java.java;hb=HEAD
+```
+
+
diff --git a/content/tag-developers/dojo-autocompleter-tag.html b/content/tag-developers/dojo-autocompleter-tag.html index 21f7429..8008534 100644 --- a/content/tag-developers/dojo-autocompleter-tag.html +++ b/content/tag-developers/dojo-autocompleter-tag.html @@ -131,70 +131,106 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter/java.java;hb=HEAD
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/autocompleter.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/autocompleter/html.java;hb=HEAD
+

Examples

Get list from an action:

-
{snippet:id=example1|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}
-
+

+```xml
+START SNIPPET: example1 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter/java.java;hb=HEAD
+```
+
+

Uses a list:

-
{snippet:id=example2|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}
-
+

+```xml
+START SNIPPET: example2 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter/java.java;hb=HEAD
+```
+
+

Autocompleter that reloads its content everytime the text changes (and the length of the text is greater than 3):

-
{snippet:id=example3|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}
-
+

+```xml
+START SNIPPET: example3 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter/java.java;hb=HEAD
+```
+
+

Linking two autocompleters:

-
{snippet:id=example4|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}
-
+

+```xml
+START SNIPPET: example4 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter/java.java;hb=HEAD
+```
+
+

Set/Get selected values using JavaScript:

-
{snippet:id=example5|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}
-
+

+```xml
+START SNIPPET: example5 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter/java.java;hb=HEAD
+```
+
+

Using beforeNotifyTopics:

-
{snippet:id=example6|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}
-
+

+```xml
+START SNIPPET: example6 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter/java.java;hb=HEAD
+```
+
+

Using errorNotifyTopics:

-
{snippet:id=example7|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}
-
+

+```xml
+START SNIPPET: example7 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter/java.java;hb=HEAD
+```
+
+

Using errorNotifyTopics:

-
{snippet:id=example8|lang=html|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}
-
+

+```html
+START SNIPPET: example8 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter/java.java;hb=HEAD
+```
+
+

Using valueNotifyTopics:

-
{snippet:id=example9|lang=html|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}
-
+

+```html
+START SNIPPET: example9 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter/java.java;hb=HEAD
+```
+
+

Caveats

diff --git a/content/tag-developers/dojo-bind-tag.html b/content/tag-developers/dojo-bind-tag.html index 6ed607d..0cf8292 100644 --- a/content/tag-developers/dojo-bind-tag.html +++ b/content/tag-developers/dojo-bind-tag.html @@ -131,8 +131,8 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind/java.java;hb=HEAD
+

There’s a bug in IE6/IE7 which makes impossible to use the target’s attribute with a parent Div, because such Div’s content’s are overwritten with the tag’s loadingText . Resulting in an “undefined” message in the content’s, instead of the result of the request.

@@ -153,46 +153,70 @@

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/bind.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/bind/html.java;hb=HEAD
+

Examples

Without attaching to an event, listening to a topic (used to make an Ajax call):

-
{snippet:id=example0|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind.java}
-
+

+```xml
+START SNIPPET: example0 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind/java.java;hb=HEAD
+```
+
+

Attached to event ‘onclick’ on submit button:

-
{snippet:id=example1|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind.java}
-
+

+```xml
+START SNIPPET: example1 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind/java.java;hb=HEAD
+```
+
+

Submit form:

-
{snippet:id=example2|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind.java}
-
+

+```xml
+START SNIPPET: example2 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind/java.java;hb=HEAD
+```
+
+

Using beforeNotifyTopics:

-
{snippet:id=example4|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind.java}
-
+

+```xml
+START SNIPPET: example4 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind/java.java;hb=HEAD
+```
+
+

Using afterNotifyTopics and highlight:

-
{snippet:id=example5|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind.java}
-
+

+```xml
+START SNIPPET: example5 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind/java.java;hb=HEAD
+```
+
+

Using errorNotifyTopics and indicator:

-
{snippet:id=example6|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind.java}
-
+

+```xml
+START SNIPPET: example6 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Bind/java.java;hb=HEAD
+```
+
+
diff --git a/content/tag-developers/dojo-datetimepicker-tag.html b/content/tag-developers/dojo-datetimepicker-tag.html index 79d9f58..762dbcc 100644 --- a/content/tag-developers/dojo-datetimepicker-tag.html +++ b/content/tag-developers/dojo-datetimepicker-tag.html @@ -131,32 +131,44 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/DateTimePicker.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/DateTimePicker/java.java;hb=HEAD
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/datetimepicker.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/datetimepicker/html.java;hb=HEAD
+

Examples

-
{snippet:id=example1|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/DateTimePicker.java}
-
+

+```xml
+START SNIPPET: example1 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/DateTimePicker/java.java;hb=HEAD
+```
+
+

Getting and getting the datetimepicker value, from JavaScript:

-
{snippet:id=example2|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/DateTimePicker.java}
-
+

+```xml
+START SNIPPET: example2 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/DateTimePicker/java.java;hb=HEAD
+```
+
+

Publish topic when value changes

-
{snippet:id=example3|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/DateTimePicker.java}
-
+

+```xml
+START SNIPPET: example3 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/DateTimePicker/java.java;hb=HEAD
+```
+
+
diff --git a/content/tag-developers/dojo-div-tag.html b/content/tag-developers/dojo-div-tag.html index 141743d..a065ffe 100644 --- a/content/tag-developers/dojo-div-tag.html +++ b/content/tag-developers/dojo-div-tag.html @@ -131,34 +131,46 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div/java.java;hb=HEAD
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/div.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/div/html.java;hb=HEAD
+

Examples

Simple div that loads its content once:

-
{snippet:id=example1|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java}
-
+

+```xml
+START SNIPPET: example1 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div/java.java;hb=HEAD
+```
+
+

div that reloads its content every 2 seconds, and shows an indicator while reloading:

-
{snippet:id=example2|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java}
-
+

+```xml
+START SNIPPET: example2 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div/java.java;hb=HEAD
+```
+
+

div that uses topics to control the timer, highlights its content in red after reload, and submits a form:

-
{snippet:id=example3|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java}
-
+

+```xml
+START SNIPPET: example3 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div/java.java;hb=HEAD
+```
+
+
diff --git a/content/tag-developers/dojo-head-tag.html b/content/tag-developers/dojo-head-tag.html index a711382..0220bda 100644 --- a/content/tag-developers/dojo-head-tag.html +++ b/content/tag-developers/dojo-head-tag.html @@ -131,18 +131,10 @@

Description

-
- - - - - - - -
{snippet:id=noticejavadoc=trueurl=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java}
- -
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java}
-
+

START SNIPPET: notice not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head/java.java;hb=HEAD

+ +
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head/java.java;hb=HEAD
+
@@ -163,18 +155,26 @@

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/head.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/head/html.java;hb=HEAD
+

Examples

-
{snippet:id=example1|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java}
-
+

+```xml
+START SNIPPET: example1 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head/java.java;hb=HEAD
+```
+
+
-
{snippet:id=example3|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java}
-
+

+```xml
+START SNIPPET: example3 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head/java.java;hb=HEAD
+```
+
+
diff --git a/content/tag-developers/dojo-submit-tag.html b/content/tag-developers/dojo-submit-tag.html index a343a9c..e9d9ae2 100644 --- a/content/tag-developers/dojo-submit-tag.html +++ b/content/tag-developers/dojo-submit-tag.html @@ -131,8 +131,8 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit/java.java;hb=HEAD
+

There’s a bug in IE6/IE7 which makes impossible to use the target’s attribute with a parent Div, because such Div’s content’s are overwritten with the tag’s loadingText . Resulting in an “undefined” message in the content’s, instead of the result of the request.

@@ -152,62 +152,98 @@

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/submit.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/submit/html.java;hb=HEAD
+

Examples

-
{snippet:id=example1|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java}
-
+

+```xml
+START SNIPPET: example1 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit/java.java;hb=HEAD
+```
+
+

Render an image submit:

-
{snippet:id=example2|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java}
-
+

+```xml
+START SNIPPET: example2 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit/java.java;hb=HEAD
+```
+
+

Render a button submit:

-
{snippet:id=example3|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java}
-
+

+```xml
+START SNIPPET: example3 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit/java.java;hb=HEAD
+```
+
+

Update target content with html returned from an action:

-
{snippet:id=example4|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java}
-
+

+```xml
+START SNIPPET: example4 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit/java.java;hb=HEAD
+```
+
+

Submit form(inside the form):

-
{snippet:id=example5|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java}
-
+

+```xml
+START SNIPPET: example5 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit/java.java;hb=HEAD
+```
+
+

Submit form(outside the form):

-
{snippet:id=example6|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java}
-
+

+```xml
+START SNIPPET: example6 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit/java.java;hb=HEAD
+```
+
+

Using beforeNotifyTopics:

-
{snippet:id=example7|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java}
-
+

+```xml
+START SNIPPET: example7 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit/java.java;hb=HEAD
+```
+
+

Using afterNotifyTopics and highlight target:

-
{snippet:id=example8|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java}
-
+

+```xml
+START SNIPPET: example8 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit/java.java;hb=HEAD
+```
+
+

Using errorNotifyTopics and indicator:

-
{snippet:id=example9|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java}
-
+

+```xml
+START SNIPPET: example9 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit/java.java;hb=HEAD
+```
+
+
diff --git a/content/tag-developers/dojo-tabbedpanel-tag.html b/content/tag-developers/dojo-tabbedpanel-tag.html index 4fbbb59..a2fa258 100644 --- a/content/tag-developers/dojo-tabbedpanel-tag.html +++ b/content/tag-developers/dojo-tabbedpanel-tag.html @@ -131,28 +131,36 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TabbedPanel.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TabbedPanel/java.java;hb=HEAD
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/a.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/a/html.java;hb=HEAD
+

Examples

The following is an example of a tabbedpanel and panel tag utilizing local and remote content:

-
{snippet:id=example1|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TabbedPanel.java}
-
+

+```xml
+START SNIPPET: example1 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TabbedPanel/java.java;hb=HEAD
+```
+
+

Use notify topics to prevent a tab from being selected:

-
{snippet:id=example2|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TabbedPanel.java}
-
+

+```xml
+START SNIPPET: example2 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TabbedPanel/java.java;hb=HEAD
+```
+
+
diff --git a/content/tag-developers/dojo-textarea-tag.html b/content/tag-developers/dojo-textarea-tag.html index cb3fba8..b5e6246 100644 --- a/content/tag-developers/dojo-textarea-tag.html +++ b/content/tag-developers/dojo-textarea-tag.html @@ -131,14 +131,14 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TextArea.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TextArea/java.java;hb=HEAD
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/textarea.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/textarea/html.java;hb=HEAD
+
diff --git a/content/tag-developers/dojo-tree-tag.html b/content/tag-developers/dojo-tree-tag.html index af84342..a0c086a 100644 --- a/content/tag-developers/dojo-tree-tag.html +++ b/content/tag-developers/dojo-tree-tag.html @@ -131,34 +131,46 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree/java.java;hb=HEAD
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/tree.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/tree/html.java;hb=HEAD
+

Examples

Static tree:

-
{snippet:id=example1|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree.java}
-
+

+```xml
+START SNIPPET: example1 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree/java.java;hb=HEAD
+```
+
+

Dynamic tree (rendered on the server):

-
{snippet:id=example2|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree.java}
-
+

+```xml
+START SNIPPET: example2 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree/java.java;hb=HEAD
+```
+
+

Dynamic tree loaded with AJAX (one request is made for each node):

-
{snippet:id=example3|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree.java}
-
+

+```xml
+START SNIPPET: example3 not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree/java.java;hb=HEAD
+```
+
+
diff --git a/content/tag-developers/dojo-treenode-tag.html b/content/tag-developers/dojo-treenode-tag.html index d3b2359..bcf1bc7 100644 --- a/content/tag-developers/dojo-treenode-tag.html +++ b/content/tag-developers/dojo-treenode-tag.html @@ -131,22 +131,26 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TreeNode.java}
-
+
START SNIPPET: javadoc not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TreeNode/java.java;hb=HEAD
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/treenode.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/ajax/treenode/html.java;hb=HEAD
+

Examples

Update target content with html returned from an action:

-
{snippet:id=example|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TreeNode.java}
-
+

+```xml
+START SNIPPET: example not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TreeNode/java.java;hb=HEAD
+```
+
+
diff --git a/content/tag-developers/doubleselect-tag.html b/content/tag-developers/doubleselect-tag.html index a804f2b..b785bc8 100644 --- a/content/tag-developers/doubleselect-tag.html +++ b/content/tag-developers/doubleselect-tag.html @@ -138,32 +138,33 @@ - - - - - - - - -
{snippet:id=javadocjavadoc=trueurl=org.apache.struts2.components.DoubleListUIBean}
+

+ Note that the doublelistkey and doublelistvalue attribute will default to "key" and "value" + respectively only when the doublelist attribute is evaluated to a Map or its descendant. + Other thing else, will result in doublelistkey and doublelistvalue to be null and not used. +

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.DoubleSelect}
-
+
 Renders two HTML select elements with second one changing displayed values depending on selected entry of first one.
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/doubleselect.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/doubleselect/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.DoubleSelect}
-
+

+```xml
+ &lt;s:doubleselect label="doubleselect test1" name="menu" list="{'fruit','other'}" doubleName="dishes" doubleList="top == 'fruit' ? {'apple', 'orange'} : {'monkey', 'chicken'}" /&gt;
+ &lt;s:doubleselect label="doubleselect test2" name="menu" list="#{'fruit':'Nice Fruits', 'other':'Other Dishes'}" doubleName="dishes" doubleList="top == 'fruit' ? {'apple', 'orange'} : {'monkey', 'chicken'}" /&gt;
+```
+
+
diff --git a/content/tag-developers/else-tag.html b/content/tag-developers/else-tag.html index e125401..2be471c 100644 --- a/content/tag-developers/else-tag.html +++ b/content/tag-developers/else-tag.html @@ -140,20 +140,35 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Else}
-
+

+ <p>Perform basic condition flow. 'If' tag could be used by itself or with 'Else If' Tag and/or single/multiple 'Else'
+ Tag.</p>
+
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/else.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/else/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.Else}
-
+

+```xml
+  &lt;s:if test="%{false}"&gt;
+      &lt;div&gt;Will Not Be Executed&lt;/div&gt;
+  &lt;/s:if&gt;
+  &lt;s:elseif test="%{true}"&gt;
+      &lt;div&gt;Will Be Executed&lt;/div&gt;
+  &lt;/s:elseif&gt;
+  &lt;s:else&gt;
+      &lt;div&gt;Will Not Be Executed&lt;/div&gt;
+  &lt;/s:else&gt;
+```
+
+
diff --git a/content/tag-developers/elseif-tag.html b/content/tag-developers/elseif-tag.html index 50d6a17..bbe4508 100644 --- a/content/tag-developers/elseif-tag.html +++ b/content/tag-developers/elseif-tag.html @@ -140,20 +140,35 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.ElseIf}
-
+

+ <p>Perform basic condition flow. 'If' tag could be used by itself or with 'Else If' Tag and/or single/multiple 'Else'
+ Tag.</p>
+
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/elseif.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/elseif/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.ElseIf}
-
+

+```xml
+  &lt;s:if test="%{false}"&gt;
+      &lt;div&gt;Will Not Be Executed&lt;/div&gt;
+  &lt;/s:if&gt;
+  &lt;s:elseif test="%{true}"&gt;
+      &lt;div&gt;Will Be Executed&lt;/div&gt;
+  &lt;/s:elseif&gt;
+  &lt;s:else&gt;
+      &lt;div&gt;Will Not Be Executed&lt;/div&gt;
+  &lt;/s:else&gt;
+```
+
+
diff --git a/content/tag-developers/fielderror-tag.html b/content/tag-developers/fielderror-tag.html index 60b6dab..462188d 100644 --- a/content/tag-developers/fielderror-tag.html +++ b/content/tag-developers/fielderror-tag.html @@ -131,24 +131,60 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.FieldError}
-
+

+ Render field errors if they exists. Specific layout depends on the particular theme.
+ The field error strings will be html escaped by default.
+
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/fielderror.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/fielderror/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.FieldError}
-
+

+```xml
+
+    &lt;!-- example 1 --&gt;
+    &lt;s:fielderror /&gt;
+
+    &lt;!-- example 2 --&gt;
+    &lt;s:fielderror&gt;
+         &lt;s:param&gt;field1&lt;/s:param&gt;
+         &lt;s:param&gt;field2&lt;/s:param&gt;
+    &lt;/s:fielderror&gt;
+    &lt;s:form .... &gt;
+       ....
+    &lt;/s:form&gt;
+
+    OR
+
+    &lt;s:fielderror&gt;
+          &lt;s:param value="%{'field1'}" /&gt;
+          &lt;s:param value="%{'field2'}" /&gt;
+    &lt;/s:fielderror&gt;
+    &lt;s:form .... &gt;
+       ....
+    &lt;/s:form&gt;
+
+    OR
+
+    &lt;s:fielderror fieldName="field1" /&gt;
+
+```
+
+
-
{snippet:id=description|javadoc=true|url=org.apache.struts2.components.FieldError}
-
+

+ Example 1: display all field errors<br>
+ Example 2: display field errors only for 'field1' and 'field2'<br>
+
+
diff --git a/content/tag-developers/file-tag.html b/content/tag-developers/file-tag.html index 3fd9577..f2fd8d8 100644 --- a/content/tag-developers/file-tag.html +++ b/content/tag-developers/file-tag.html @@ -140,20 +140,25 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.File}
-
+
 Renders an HTML file input element.
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/file.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/file/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.File}
-
+

+```xml
+ &lt;s:file name="anUploadFile" accept="text/*" /&gt;
+ &lt;s:file name="anohterUploadFIle" accept="text/html,text/plain" /&gt;
+```
+
+
diff --git a/content/tag-developers/form-tag.html b/content/tag-developers/form-tag.html index 86e70d2..ae9a6ef 100644 --- a/content/tag-developers/form-tag.html +++ b/content/tag-developers/form-tag.html @@ -140,20 +140,54 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Form}
-
+
 <p>
+ Renders HTML an input form.
+ </p>
+
+ <p>
+ The remote form allows the form to be submitted without the page being refreshed. The results from the form
+ can be inserted into any HTML element on the page.
+ </p>
+ <p>
+ NOTE:<br>
+ The order / logic in determining the posting url of the generated HTML form is as follows:
+ </p>
+
+ <ol>
+ <li>
+ If the action attribute is not specified, then the current request will be used to
+ determine the posting url
+ </li>
+ <li>
+ If the action is given, Struts will try to obtain an ActionConfig. This will be
+ successful if the action attribute is a valid action alias defined struts.xml.
+ </li>
+ <li>
+ If the action is given and is not an action alias defined in struts.xml, Struts
+ will used the action attribute as if it is the posting url, separting the namespace
+ from it and using UrlHelper to generate the final url.
+ </li>
+ </ol>
+
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/form.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/form/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.Form}
-
+

+```xml
+
+ &lt;s:form ... /&gt;
+
+```
+
+

Validation

diff --git a/content/tag-developers/form-tags.html b/content/tag-developers/form-tags.html index 4b8aa5b..5df383e 100644 --- a/content/tag-developers/form-tags.html +++ b/content/tag-developers/form-tags.html @@ -215,26 +215,298 @@

Template-Related Attributes

-
{snippet:id=templateRelatedAttributes|javadoc=true|url=org.apache.struts2.components.UIBean}
-
+

+ <table border="1" summary="">
+    <thead>
+       <tr>
+          <td>Attribute</td>
+          <td>Theme</td>
+          <td>Data Types</td>
+          <td>Description</td>
+       </tr>
+    </thead>
+    <tbody>
+       <tr>
+          <td>templateDir</td>
+          <td>n/a</td>
+          <td>String</td>
+          <td>define the template directory</td>
+       </tr>
+       <tr>
+          <td>theme</td>
+          <td>n/a</td>
+          <td>String</td>
+          <td>define the theme name</td>
+       </tr>
+       <tr>
+          <td>template</td>
+          <td>n/a</td>
+          <td>String</td>
+          <td>define the template name</td>
+       </tr>
+       <tr>
+          <td>themeExpansionToken</td>
+          <td>n/a</td>
+          <td>String</td>
+          <td>special token (defined with struts.ui.theme.expansion.token) used to search for template in parent theme
+          (don't use it separately!)</td>
+       </tr>
+       <tr>
+          <td>expandTheme</td>
+          <td>n/a</td>
+          <td>String</td>
+          <td>concatenation of themeExpansionToken and theme which tells internal template loader mechanism
+          to try load template from current theme and then from parent theme (and parent theme, and so on)
+          when used with &lt;#include/&gt; directive</td>
+       </tr>
+    </tbody>
+ </table>
+
+

Javascript-Related Attributes

-
{snippet:id=javascriptRelatedAttributes|javadoc=true|url=org.apache.struts2.components.UIBean}
-
+

+ <table border="1" summary="">
+    <thead>
+       <tr>
+          <td>Attribute</td>
+          <td>Theme</td>
+          <td>Data Types</td>
+          <td>Description</td>
+       </tr>
+    </thead>
+    <tbody>
+       <tr>
+          <td>onclick</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>html javascript onclick attribute</td>
+       </tr>
+       <tr>
+          <td>ondblclick</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>html javascript ondbclick attribute</td>
+       </tr>
+       <tr>
+          <td>onmousedown</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>html javascript onmousedown attribute</td>
+       </tr>
+       <tr>
+          <td>onmouseup</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>html javascript onmouseup attribute</td>
+       </tr>
+       <tr>
+          <td>onmouseover</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>html javascript onmouseover attribute</td>
+       </tr>
+       <tr>
+          <td>onmouseout</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>html javascript onmouseout attribute</td>
+       </tr>
+       <tr>
+          <td>onfocus</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>html javascript onfocus attribute</td>
+       </tr>
+       <tr>
+          <td>onblur</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>html javascript onblur attribute</td>
+       </tr>
+       <tr>
+          <td>onkeypress</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>html javascript onkeypress attribute</td>
+       </tr>
+       <tr>
+          <td>onkeyup</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>html javascript onkeyup attribute</td>
+       </tr>
+       <tr>
+          <td>onkeydown</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>html javascript onkeydown attribute</td>
+       </tr>
+       <tr>
+          <td>onselect</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>html javascript onselect attribute</td>
+       </tr>
+       <tr>
+          <td>onchange</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>html javascript onchange attribute</td>
+       </tr>
+    </tbody>
+ </table>
+
+

Tooltip Related Attributes

-
{snippet:id=tooltipattributes|javadoc=true|url=org.apache.struts2.components.UIBean}
-
+

+ <table border="1" summary="">
+  <tr>
+     <td>Attribute</td>
+     <td>Data Type</td>
+     <td>Default</td>
+     <td>Description</td>
+  </tr>
+  <tr>
+      <td>tooltip</td>
+      <td>String</td>
+      <td>none</td>
+      <td>Set the tooltip of this particular component</td>
+  </tr>
+  <tr>
+      <td>jsTooltipEnabled</td>
+      <td>String</td>
+      <td>false</td>
+      <td>Enable js tooltip rendering</td>
+  </tr>
+    <tr>
+      <td>tooltipIcon</td>
+      <td>String</td>
+      <td>/struts/static/tooltip/tooltip.gif</td>
+      <td>The url to the tooltip icon</td>
+   <tr>
+      <td>tooltipDelay</td>
+      <td>String</td>
+      <td>500</td>
+      <td>Tooltip shows up after the specified timeout (miliseconds). A behavior similar to that of OS based tooltips.</td>
+   </tr>
+   <tr>
+      <td>key</td>
+      <td>simple</td>
+      <td>String</td>
+      <td>The name of the property this input field represents.  This will auto populate the name, label, and value</td>
+   </tr>
+ </table>
+
+

General Attributes

-
{snippet:id=generalAttributes|javadoc=true|url=org.apache.struts2.components.UIBean}
-
+

+ <table border="1" summary="">
+    <thead>
+       <tr>
+          <td>Attribute</td>
+          <td>Theme</td>
+          <td>Data Types</td>
+          <td>Description</td>
+       </tr>
+    </thead>
+    <tbody>
+       <tr>
+          <td>cssClass</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>define html class attribute</td>
+       </tr>
+       <tr>
+          <td>cssStyle</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>define html style attribute</td>
+       </tr>
+       <tr>
+          <td>cssErrorClass</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>error class attribute</td>
+       </tr>
+       <tr>
+          <td>cssErrorStyle</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>error style attribute</td>
+       </tr>
+       <tr>
+          <td>title</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>define html title attribute</td>
+       </tr>
+       <tr>
+          <td>disabled</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>define html disabled attribute</td>
+       </tr>
+       <tr>
+          <td>label</td>
+          <td>xhtml</td>
+          <td>String</td>
+          <td>define label of form element</td>
+       </tr>
+       <tr>
+          <td>labelPosition</td>
+          <td>xhtml</td>
+          <td>String</td>
+          <td>define label position of form element (top/left), default to left</td>
+       </tr>
+       <tr>
+          <td>requiredPosition</td>
+          <td>xhtml</td>
+          <td>String</td>
+          <td>define required label position of form element (left/right), default to right</td>
+       </tr>
+       <tr>
+          <td>errorPosition</td>
+          <td>xhtml</td>
+          <td>String</td>
+          <td>define error position of form element (top|bottom), default to top</td>
+       </tr>
+       <tr>
+          <td>name</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>Form Element's field name mapping</td>
+       </tr>
+       <tr>
+          <td>requiredLabel</td>
+          <td>xhtml</td>
+          <td>Boolean</td>
+          <td>add * to label (true to add false otherwise)</td>
+       </tr>
+       <tr>
+          <td>tabIndex</td>
+          <td>simple</td>
+          <td>String</td>
+          <td>define html tabindex attribute</td>
+       </tr>
+       <tr>
+          <td>value</td>
+          <td>simple</td>
+          <td>Object</td>
+          <td>define value of form element</td>
+       </tr>
+    </tbody>
+ </table>
+
+
@@ -417,12 +689,98 @@

Tooltip

-
{snippet:id=tooltipdescription|javadoc=true|url=org.apache.struts2.components.UIBean}
-
+
 <p>
+ <b>tooltipConfig is deprecated, use individual tooltip configuration attributes instead </b>
+ </p>
+
+ <p>
+ Every Form UI component (in xhtml / css_xhtml or any other that extends them) can
+ have tooltips assigned to them. The Form component's tooltip related attribute, once
+ defined, will be applied to all form UI components that are created under it unless
+ explicitly overridden by having the Form UI component itself defined with their own tooltip attribute.
+ </p>
+
+ <p>
+ In Example 1, the textfield will inherit the tooltipDelay and tooltipIconPath attribute from
+ its containing form. In other words, although it doesn't define a tooltipIconPath
+ attribute, it will have that attribute inherited from its containing form.
+ </p>
+
+ <p>
+ In Example 2, the  textfield will inherit both the tooltipDelay and
+ tooltipIconPath attribute from its containing form, but the tooltipDelay
+ attribute is overridden at the textfield itself. Hence, the textfield actually will
+ have its tooltipIcon defined as /myImages/myIcon.gif, inherited from its containing form, and
+ tooltipDelay defined as 5000.
+ </p>
+
+ <p>
+ Example 3, 4 and 5 show different ways of setting the tooltip configuration attribute.<br>
+ <b>Example 3:</b> Set tooltip config through the body of the param tag<br>
+ <b>Example 4:</b> Set tooltip config through the value attribute of the param tag<br>
+ <b>Example 5:</b> Set tooltip config through the tooltip attributes of the component tag<br>
+ </p>
+
+
-
{snippet:id=tooltipexample|lang=xml|javadoc=true|url=org.apache.struts2.components.UIBean}
-
+

+```xml
+
+ &lt;!-- Example 1: --&gt;
+ &lt;s:form
+          tooltipDelay="500"
+          tooltipIconPath="/myImages/myIcon.gif" .... &gt;
+   ....
+     &lt;s:textfield label="Customer Name" tooltip="Enter the customer name" .... /&gt;
+   ....
+ &lt;/s:form&gt;
+
+ &lt;!-- Example 2: --&gt;
+ &lt;s:form
+          tooltipDelay="500"
+          tooltipIconPath="/myImages/myIcon.gif" .... &gt;
+   ....
+     &lt;s:textfield label="Address"
+          tooltip="Enter your address"
+          tooltipDelay="5000" /&gt;
+   ....
+ &lt;/s:form&gt;
+
+
+ &lt;-- Example 3: --&gt;
+ &lt;s:textfield
+        label="Customer Name"
+        tooltip="One of our customer Details"&gt;
+        &lt;s:param name="tooltipDelay"&gt;
+             500
+        &lt;/s:param&gt;
+        &lt;s:param name="tooltipIconPath"&gt;
+             /myImages/myIcon.gif
+        &lt;/s:param&gt;
+ &lt;/s:textfield&gt;
+
+
+ &lt;-- Example 4: --&gt;
+ &lt;s:textfield
+          label="Customer Address"
+          tooltip="Enter The Customer Address" &gt;
+          &lt;s:param
+              name="tooltipDelay"
+              value="500" /&gt;
+ &lt;/s:textfield&gt;
+
+
+ &lt;-- Example 5: --&gt;
+ &lt;s:textfield
+          label="Customer Telephone Number"
+          tooltip="Enter customer Telephone Number"
+          tooltipDelay="500"
+          tooltipIconPath="/myImages/myIcon.gif" /&gt;
+
+```
+
+
diff --git a/content/tag-developers/generator-tag.html b/content/tag-developers/generator-tag.html index 0f11af8..f29ef55 100644 --- a/content/tag-developers/generator-tag.html +++ b/content/tag-developers/generator-tag.html @@ -131,20 +131,95 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.views.jsp.iterator.IteratorGeneratorTag}
-
+
 <b>NOTE: JSP-TAG</b>
+
+ <p>Generate an iterator based on the val attribute supplied.</P>
+
+ <b>NOTE:</b> The generated iterator will <b>ALWAYS</b> be pushed into the top of the stack, and poped
+ at the end of the tag.
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/generator.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/generator/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.views.jsp.iterator.IteratorGeneratorTag}
-
+

+```xml
+ Example One:
+ <pre>
+ Generate a simple iterator
+ &lt;s:generator val="%{'aaa,bbb,ccc,ddd,eee'}"&gt;
+  &lt;s:iterator&gt;
+      &lt;s:property /&gt;&lt;br/&gt;
+  &lt;/s:iterator&gt;
+ &lt;/s:generator&gt;
+ </pre>
+ This generates an iterator and print it out using the iterator tag.
+
+ Example Two:
+ <pre>
+ Generate an iterator with count attribute
+ &lt;s:generator val="%{'aaa,bbb,ccc,ddd,eee'}" count="3"&gt;
+  &lt;s:iterator&gt;
+      &lt;s:property /&gt;&lt;br/&gt;
+  &lt;/s:iterator&gt;
+ &lt;/s:generator&gt;
+ </pre>
+ This generates an iterator, but only 3 entries will be available in the iterator
+ generated, namely aaa, bbb and ccc respectively because count attribute is set to 3
+
+ Example Three:
+ <pre>
+ Generate an iterator with var attribute
+ &lt;s:generator val="%{'aaa,bbb,ccc,ddd,eee'}" count="4" separator="," var="myAtt" /&gt;
+ &lt;%
+  Iterator i = (Iterator) pageContext.getAttribute("myAtt");
+  while(i.hasNext()) {
+      String s = (String) i.next(); %&gt;
+      &lt;%=s%&gt; &lt;br/&gt;
+ &lt;%    }
+ %&gt;
+ </pre>
+ This generates an iterator and put it in the PageContext under the key as specified
+ by the var attribute.
+
+
+ Example Four:
+ <pre>
+ Generate an iterator with comparator attribute
+ &lt;s:generator val="%{'aaa,bbb,ccc,ddd,eee'}" converter="%{myConverter}"&gt;
+  &lt;s:iterator&gt;
+      &lt;s:property /&gt;&lt;br/&gt;
+  &lt;/s:iterator&gt;
+ &lt;/s:generator&gt;
+
+
+ public class GeneratorTagAction extends ActionSupport {
+
+   ....
+
+   public Converter getMyConverter() {
+      return new Converter() {
+          public Object convert(String value) throws Exception {
+              return "converter-"+value;
+          }
+      };
+   }
+
+   ...
+
+ }
+ </pre>
+ This will generate an iterator with each entries decided by the converter supplied. With
+ this converter, it simply add "converter-" to each entries.
+```
+
+
diff --git a/content/tag-developers/head-tag.html b/content/tag-developers/head-tag.html index 3d88ade..af555c6 100644 --- a/content/tag-developers/head-tag.html +++ b/content/tag-developers/head-tag.html @@ -140,20 +140,28 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Head}
-
+

+ Renders parts of the HEAD section for an HTML file. Encoding can be set using this tag.
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/head.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/head/html.java;hb=HEAD
+

Examples

-
{snippet:id=example1|lang=xml|javadoc=true|url=org.apache.struts2.components.Head}
-
+

+```xml
+ &lt;head&gt;
+   &lt;title&gt;My page&lt;/title&gt;
+   &lt;s:head/&gt;
+ &lt;/head&gt;
+```
+
+
diff --git a/content/tag-developers/hidden-tag.html b/content/tag-developers/hidden-tag.html index 21b8585..8ae0ec9 100644 --- a/content/tag-developers/hidden-tag.html +++ b/content/tag-developers/hidden-tag.html @@ -140,20 +140,32 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Hidden}
-
+
 Renders an HTML input element of type hidden, populated by the specified property from the ValueStack.
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/hidden.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/hidden/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.Hidden}
-
+

+```xml
+ &lt;-- example one --&gt;
+ &lt;s:hidden name="foo" /&gt;
+ &lt;-- example two --&gt;
+ &lt;s:hidden name="foo" value="%{bar}" /&gt;
+
+ Example One Resulting HTML (if foo evaluates to bar):
+ &lt;input type="hidden" name="foo" value="bar" /&gt;
+ Example Two Resulting HTML (if getBar method of the action returns 'bar')
+ &lt;input type="hidden" name="foo" value="bar" /&gt;
+```
+
+
diff --git a/content/tag-developers/i18n-tag.html b/content/tag-developers/i18n-tag.html index 3435b92..e99965e 100644 --- a/content/tag-developers/i18n-tag.html +++ b/content/tag-developers/i18n-tag.html @@ -140,20 +140,32 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.I18n}
-
+

+ Gets a resource bundle and place it on the value stack. This allows
+ the text tag to access messages from any bundle, and not just the bundle
+ associated with the current action.
+
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/i18n.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/i18n/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.I18n}
-
+

+```xml
+
+ &lt;s:i18n name="myCustomBundle"&gt;
+    The i18n value for key aaa.bbb.ccc in myCustomBundle is &lt;s:property value="text('aaa.bbb.ccc')" /&gt;
+ &lt;/s:i18n&gt;
+
+```
+
+
diff --git a/content/tag-developers/if-tag.html b/content/tag-developers/if-tag.html index 6e1f58d..97492ae 100644 --- a/content/tag-developers/if-tag.html +++ b/content/tag-developers/if-tag.html @@ -144,14 +144,18 @@

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/if.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/if/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=struts2/core/src/main/java/org/apache/struts2/components/If.java}
-
+

+```xml
+START SNIPPET: example not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2/core/src/main/java/org/apache/struts2/components/If/java.java;hb=HEAD
+```
+
+
diff --git a/content/tag-developers/include-tag.html b/content/tag-developers/include-tag.html index 08bdb06..98ceb62 100644 --- a/content/tag-developers/include-tag.html +++ b/content/tag-developers/include-tag.html @@ -140,8 +140,13 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Include}
-
+
 <p>Include a servlet's output (result of servlet or a JSP page).</p>
+ <p>Note: Any additional params supplied to the included page are <b>not</b>
+ accessible within the rendered page through the &lt;s:property...&gt; tag
+ since no valuestack will be created. You can, however, access them in a
+ servlet via the HttpServletRequest object or from a JSP page via
+ a scriptlet.</p>
+

(!) How To access parameters

@@ -164,18 +169,41 @@

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/include.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/include/html.java;hb=HEAD
+

Example

-
{snippet:id=example|lang=java|javadoc=true|url=org.apache.struts2.components.Include}
-
+

+```java
+ &lt;-- One: --&gt;
+ &lt;s:include value="myJsp.jsp" /&gt;
+
+ &lt;-- Two: --&gt;
+ &lt;s:include value="myJsp.jsp"&gt;
+    &lt;s:param name="param1" value="value2" /&gt;
+    &lt;s:param name="param2" value="value2" /&gt;
+ &lt;/s:include&gt;
+
+ &lt;-- Three: --&gt;
+ &lt;s:include value="myJsp.jsp"&gt;
+    &lt;s:param name="param1"&gt;value1&lt;/s:param&gt;
+    &lt;s:param name="param2"&gt;value2&lt;/s:param&gt;
+ &lt;/s:include&gt;
+```
+
+
-
{snippet:id=exampledescription|lang=none|javadoc=true|url=org.apache.struts2.components.Include}
-
+

+```none
+ Example one - do an include myJsp.jsp page
+ Example two - do an include to myJsp.jsp page with parameters param1=value1 and param2=value2
+ Example three - do an include to myJsp.jsp page with parameters param1=value1 and param2=value2
+```
+
+
diff --git a/content/tag-developers/inputtransferselect-tag.html b/content/tag-developers/inputtransferselect-tag.html index a2748cb..cec092c 100644 --- a/content/tag-developers/inputtransferselect-tag.html +++ b/content/tag-developers/inputtransferselect-tag.html @@ -131,30 +131,43 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.InputTransferSelect}
-
+
 <p>
+ Create a input transfer select component which is basically an text input
+ and  &lt;select ...&gt; tag with buttons in the middle of them allowing text
+ to be added to the transfer select. Will auto-select all its
+ elements upon its containing form submission.
+ </p>
+
-
- - - - - - - -
{snippet:id=noticejavadoc=trueurl=org.apache.struts2.components.InputTransferSelect}
+

+ NOTE: The id and doubleId need not be supplied as they will generated provided + that the inputtransferselect tag is being used in a form tag. The generated id + and doubleId will be <form_id>_<inputtransferselect_doubleName> and + <form_id>_<inputtransferselect_doubleName> respectively. +

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/inputtransferselect.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/inputtransferselect/html.java;hb=HEAD
+

Example

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.InputTransferSelect}
-
+

+```xml
+
+ &lt;-- minimum configuration --&gt;
+ &lt;s:inputtransferselect
+      label="Favourite Cartoons Characters"
+      name="cartoons"
+      list="{'Popeye', 'He-Man', 'Spiderman'}"
+  /&gt;
+
+```
+
+
diff --git a/content/tag-developers/iterator-tag.html b/content/tag-developers/iterator-tag.html index a8aa427..0929920 100644 --- a/content/tag-developers/iterator-tag.html +++ b/content/tag-developers/iterator-tag.html @@ -155,72 +155,186 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.IteratorComponent}
-
+

+ <p>Iterator will iterate over a value. An iterable value can be any of: java.util.Collection, java.util.Iterator,
+ java.util.Enumeration, java.util.Map, or an array.</p>
+
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/iterator.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/iterator/html.java;hb=HEAD
+

Examples

-
{snippet:id=example1description|javadoc=true|url=org.apache.struts2.components.IteratorComponent}
-
+

+ <p>The following example retrieves the value of the getDays() method of the current object on the value stack and
+ uses it to iterate over. The &lt;s:property/&gt; tag prints out the current value of the iterator.</p>
+
+
-
{snippet:id=example1code|lang=xml|javadoc=true|url=org.apache.struts2.components.IteratorComponent}
-
+

+```xml
+ &lt;s:iterator value="days"&gt;
+   &lt;p&gt;day is: &lt;s:property/&gt;&lt;/p&gt;
+ &lt;/s:iterator&gt;
+```
+
+
-
{snippet:id=example2description|javadoc=true|url=org.apache.struts2.components.IteratorComponent}
-
+

+ <p>The following example uses a {@link Bean} tag and places it into the ActionContext. The iterator tag will retrieve
+ that object from the ActionContext and then calls its getDays() method as above. The status attribute is also used to
+ create an {@link IteratorStatus} object, which in this example, its odd() method is used to alternate row
+ colours:</p>
+
+
-
{snippet:id=example2code|lang=xml|javadoc=true|url=org.apache.struts2.components.IteratorComponent}
-
+

+```xml
+
+ &lt;s:bean name="org.apache.struts2.example.IteratorExample" var="it"&gt;
+   &lt;s:param name="day" value="'foo'"/&gt;
+   &lt;s:param name="day" value="'bar'"/&gt;
+ &lt;/s:bean&gt;
+
+ &lt;table border="0" cellspacing="0" cellpadding="1"&gt;
+ &lt;tr&gt;
+   &lt;th&gt;Days of the week&lt;/th&gt;
+ &lt;/tr&gt;
+
+ &lt;s:iterator value="#it.days" status="rowstatus"&gt;
+   &lt;tr&gt;
+     &lt;s:if test="#rowstatus.odd == true"&gt;
+       &lt;td style="background: grey"&gt;&lt;s:property/&gt;&lt;/td&gt;
+     &lt;/s:if&gt;
+     &lt;s:else&gt;
+       &lt;td&gt;&lt;s:property/&gt;&lt;/td&gt;
+     &lt;/s:else&gt;
+   &lt;/tr&gt;
+ &lt;/s:iterator&gt;
+ &lt;/table&gt;
+
+```
+
+
-
{snippet:id=example3description|javadoc=true|url=org.apache.struts2.components.IteratorComponent}
-
+
START SNIPPET: example3description not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/org/apache/struts2/components/IteratorComponent.java;hb=HEAD
+
-
{snippet:id=example3code|lang=xml|javadoc=true|url=org.apache.struts2.components.IteratorComponent}
-
+

+```xml
+
+  &lt;s:iterator value="groupDao.groups" status="groupStatus"&gt;
+      &lt;tr class="&lt;s:if test="#groupStatus.odd == true "&gt;odd&lt;/s:if&gt;&lt;s:else&gt;even&lt;/s:else&gt;"&gt;
+          &lt;td&gt;&lt;s:property value="name" /&gt;&lt;/td&gt;
+          &lt;td&gt;&lt;s:property value="description" /&gt;&lt;/td&gt;
+          &lt;td&gt;
+              &lt;s:iterator value="users" status="userStatus"&gt;
+                  &lt;s:property value="fullName" /&gt;&lt;s:if test="!#userStatus.last"&gt;,&lt;/s:if&gt;
+              &lt;/s:iterator&gt;
+          &lt;/td&gt;
+      &lt;/tr&gt;
+  &lt;/s:iterator&gt;
+
+```
+
+
-
{snippet:id=example4description|javadoc=true|url=org.apache.struts2.components.IteratorComponent}
-
+

+ <p> The next example iterates over a an action collection and passes every iterator value to another action. The
+ trick here lies in the use of the '[0]' operator. It takes the current iterator value and passes it on to the edit
+ action. Using the '[0]' operator has the same effect as using &lt;s:property /&gt;. (The latter, however, does not
+ work from inside the param tag). </p>
+
+
-
{snippet:id=example4code|lang=xml|javadoc=true|url=org.apache.struts2.components.IteratorComponent}
-
+

+```xml
+
+      &lt;s:action name="entries" var="entries"/&gt;
+      &lt;s:iterator value="#entries.entries" &gt;
+          &lt;s:property value="name" /&gt;
+          &lt;s:property /&gt;
+          &lt;s:push value="..."&gt;
+              &lt;s:action name="edit" var="edit" &gt;
+                  &lt;s:param name="entry" value="[0]" /&gt;
+              &lt;/s:action&gt;
+          &lt;/push&gt;
+      &lt;/s:iterator&gt;
+
+```
+
+
-
{snippet:id=example5description|javadoc=true|url=org.apache.struts2.components.IteratorComponent}
-
+

+ <p>A loop that iterates 5 times</p>
+
+
-
{snippet:id=example5code|lang=xml|javadoc=true|url=org.apache.struts2.components.IteratorComponent}
-
+

+```xml
+
+ &lt;s:iterator var="counter" begin="1" end="5" &gt;
+    &lt;!-- current iteration value (1, ... 5) --&gt;
+    &lt;s:property value="top" /&gt;
+ &lt;/s:iterator&gt;
+
+```
+
+
-
{snippet:id=example6description|javadoc=true|url=org.apache.struts2.components.IteratorComponent}
-
+

+ <p>Another way to create a simple loop, similar to JSTL's
+ &lt;c:forEach begin="..." end="..." ...&gt; is to use some 
+ OGNL magic, which provides some under-the-covers magic to 
+ make 0-n loops trivial. This example also loops five times.</p>
+
+
-
{snippet:id=example6code|lang=xml|javadoc=true|url=org.apache.struts2.components.IteratorComponent}
-
+

+```xml
+
+ &lt;s:iterator status="stat" value="(5).{ #this }" &gt;
+    &lt;s:property value="#stat.count" /&gt; &lt;!-- Note that "count" is 1-based, "index" is 0-based. --&gt;
+ &lt;/s:iterator&gt;
+
+```
+
+
-
{snippet:id=example7description|javadoc=true|url=org.apache.struts2.components.IteratorComponent}
-
+

+ <p>A loop that iterates over a partial list</p>
+
+
-
{snippet:id=example7code|lang=xml|javadoc=true|url=org.apache.struts2.components.IteratorComponent}
-
+

+```xml
+
+ &lt;s:iterator value="{1,2,3,4,5}" begin="2" end="4" &gt;
+    &lt;!-- current iteration value (2,3,4) --&gt;
+    &lt;s:property value="top" /&gt;
+ &lt;/s:iterator&gt;
+
+```
+
+
diff --git a/content/tag-developers/label-tag.html b/content/tag-developers/label-tag.html index 5175d94..8840489 100644 --- a/content/tag-developers/label-tag.html +++ b/content/tag-developers/label-tag.html @@ -140,24 +140,35 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Label}
-
+
 <p>Renders an HTML LABEL that will allow you to output label:name combination that has the same format treatment as
+ the rest of your UI controls.</p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/label.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/label/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.Label}
-
+

+```xml
+ &lt;s:label key="userName" /&gt;
+```
+
+
-
{snippet:id=exdescription|lang=none|javadoc=true|url=org.apache.struts2.components.Label}
-
+

+```none
+ <p>In this example, a label is rendered. The label is retrieved from a ResourceBundle via the key attribute
+ giving you an output of 'User Name: Ford.Prefect'. Assuming that i18n message userName corresponds
+ to 'User Name' and the action's getUserName() method returns 'Ford.Prefect'</p>
+```
+
+
diff --git a/content/tag-developers/merge-tag.html b/content/tag-developers/merge-tag.html index 39551d6..dfc8905 100644 --- a/content/tag-developers/merge-tag.html +++ b/content/tag-developers/merge-tag.html @@ -140,24 +140,97 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.MergeIterator}
-
+
 <p>Component for MergeIteratorTag, which job is to merge iterators and successive
+ call to the merged iterator will cause each merge iterator to have a chance to
+ expose its element, subsequently next call will allow the next iterator to expose
+ its element. Once the last iterator is done exposing its element, the first iterator
+ is allowed to do so again (unless it is exhausted of entries).</P>
+
+ <p>Internally the task are delegated to MergeIteratorFilter</p>
+
+ <p>Example if there are 3 lists being merged, each list have 3 entries, the following will
+ be the logic.</P>
+ <ol>
+      <li>Display first element of the first list</li>
+      <li>Display first element of the second list</li>
+      <li>Display first element of the third list</li>
+      <li>Display second element of the first list</li>
+      <li>Display second element of the second list</li>
+      <li>Display second element of the third list</li>
+      <li>Display third element of the first list</li>
+      <li>Display thrid element of the second list</li>
+      <li>Display third element of the thrid list</li>
+ </ol>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/merge.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/merge/html.java;hb=HEAD
+

Examples

-
{snippet:id=javacode|lang=java|javadoc=true|url=org.apache.struts2.components.MergeIterator}
-
+

+```java
+ public class MergeIteratorTagAction extends ActionSupport {
+
+  private List myList1;
+  private List myList2;
+  private List myList3;
+
+  public List getMyList1() {
+      return myList1;
+  }
+
+  public List getMyList2() {
+      return myList2;
+  }
+
+  public List getMyList3() {
+      return myList3;
+  }
+
+
+  public String execute() throws Exception {
+
+      myList1 = new ArrayList();
+      myList1.add("1");
+      myList1.add("2");
+      myList1.add("3");
+
+      myList2 = new ArrayList();
+      myList2.add("a");
+      myList2.add("b");
+      myList2.add("c");
+
+      myList3 = new ArrayList();
+      myList3.add("A");
+      myList3.add("B");
+      myList3.add("C");
+
+      return "done";
+  }
+ }
+```
+
+
-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.MergeIterator}
-
+

+```xml
+ &lt;s:merge var="myMergedIterator1"&gt;
+      &lt;s:param value="%{myList1}" /&gt;
+      &lt;s:param value="%{myList2}" /&gt;
+      &lt;s:param value="%{myList3}" /&gt;
+ &lt;/s:merge&gt;
+ &lt;s:iterator value="%{#myMergedIterator1}"&gt;
+      &lt;s:property /&gt;
+ &lt;/s:iterator&gt;
+```
+
+
diff --git a/content/tag-developers/optgroup-tag.html b/content/tag-developers/optgroup-tag.html index c9ef6e3..8e34648 100644 --- a/content/tag-developers/optgroup-tag.html +++ b/content/tag-developers/optgroup-tag.html @@ -140,30 +140,40 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.OptGroup}
-
+
 <p>
+ Create a optgroup component which needs to resides within a select tag.
+ </p>
+
- - - - - - - - -
{snippet:id=noticejavadoc=trueurl=org.apache.struts2.components.OptGroup}
+

+ This component is to be used within a Select component. +

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/optgroup.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/optgroup/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.OptGroup}
-
+

+```xml
+
+ &lt;s:select label="My Selection"
+            name="mySelection"
+            value="%{'POPEYE'}"
+            list="%{#{'SUPERMAN':'Superman', 'SPIDERMAN':'spiderman'}}"&gt;
+    &lt;s:optgroup label="Adult"
+                 list="%{#{'SOUTH_PARK':'South Park'}}" /&gt;
+    &lt;s:optgroup label="Japanese"
+                 list="%{#{'POKEMON':'pokemon','DIGIMON':'digimon','SAILORMOON':'Sailormoon'}}" /&gt;
+ &lt;/s:select&gt;
+
+```
+
+
diff --git a/content/tag-developers/optiontransferselect-tag.html b/content/tag-developers/optiontransferselect-tag.html index 0a02866..b8b6612 100644 --- a/content/tag-developers/optiontransferselect-tag.html +++ b/content/tag-developers/optiontransferselect-tag.html @@ -138,36 +138,75 @@ - - - - - - - - -
{snippet:id=javadocjavadoc=trueurl=org.apache.struts2.components.DoubleListUIBean}
+

+ Note that the doublelistkey and doublelistvalue attribute will default to "key" and "value" + respectively only when the doublelist attribute is evaluated to a Map or its descendant. + Other thing else, will result in doublelistkey and doublelistvalue to be null and not used. +

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.OptionTransferSelect}
-
+
 <p>
+ Create a option transfer select component which is basically two &lt;select ...&gt;
+ tag with buttons in the middle of them allowing options in each of the
+ &lt;select ...&gt; to be moved between themselves. Will auto-select all its
+ elements upon its containing form submision.
+ </p>
+
-
{snippet:id=notice|javadoc=true|url=org.apache.struts2.components.OptionTransferSelect}
-
+
 <p>
+ NOTE: The id and doubleId need not be supplied as they will generated provided
+ that the optiontransferselect tag is being used in a form tag. The generated id
+ and doubleId will be &lt;form_id&gt;_&lt;optiontransferselect_nameame&gt; and
+ &lt;form_id&gt;_&lt;optiontransferselect_doubleName&gt; respectively.
+ </p>
+
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/optiontransferselect.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/optiontransferselect/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.OptionTransferSelect}
-
+

+```xml
+
+ &lt;-- minimum configuration --&gt;
+ &lt;s:optiontransferselect
+      label="Favourite Cartoons Characters"
+      name="leftSideCartoonCharacters"
+      list="{'Popeye', 'He-Man', 'Spiderman'}"
+      doubleName="rightSideCartoonCharacters"
+      doubleList="{'Superman', 'Mickey Mouse', 'Donald Duck'}"
+  /&gt;
+
+  &lt;-- possible configuration --&gt;
+  &lt;s:optiontransferselect
+      label="Favourite Cartoons Characters"
+      name="leftSideCartoonCharacters"
+      leftTitle="Left Title"
+      rightTitle="Right Title"
+      list="{'Popeye', 'He-Man', 'Spiderman'}"
+      multiple="true"
+      headerKey="headerKey"
+      headerValue="--- Please Select ---"
+      emptyOption="true"
+      doubleList="{'Superman', 'Mickey Mouse', 'Donald Duck'}"
+      doubleName="rightSideCartoonCharacters"
+      doubleHeaderKey="doubleHeaderKey"
+      doubleHeaderValue="--- Please Select ---"
+      doubleEmptyOption="true"
+      doubleMultiple="true"
+  /&gt;
+
+```
+
+
diff --git a/content/tag-developers/param-tag.html b/content/tag-developers/param-tag.html index 97d330d..c528251 100644 --- a/content/tag-developers/param-tag.html +++ b/content/tag-developers/param-tag.html @@ -140,24 +140,79 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Param}
-
+
 <p>This tag can be used to parameterize other tags.<br>
+ The include tag and bean tag are examples of such tags.
+ </p>
+
+ <p>
+ The parameters can be added with or without a name as key.
+ If the tag provides a name attribute the parameters are added using the
+ {@link Component#addParameter(String, Object) addParamter} method.
+ For unnamed parameters the Tag must implement the {@link UnnamedParametric} interface defined in
+ this class (e.g. The TextTag does this).
+ </p>
+
+ <p>
+ This tag has the following two paramters.
+ </p>
+ <!-- START SNIPPET: params -->
+ <ul>
+      <li>name (String) - the name of the parameter</li>
+      <li>value (Object) - the value of the parameter</li>
+      <li>suppressEmptyParameters (boolean) - whether to suppress this parameter if empty</li>
+ </ul>
+ <!-- END SNIPPET: params -->
+ <p>
+ <b>Note:</b>
+ When you declare the param tag, the value can be defined in either a <tt>value</tt> attribute or
+ as text between the start and end tag. Struts behaves a bit different according to these two situations.
+ This is best illustrated using an example:
+ <br>&lt;param name="color"&gt;blue&lt;/param&gt; &lt;-- (A) --&gt;
+ <br>&lt;param name="color" value="blue"/&gt; &lt;-- (B) --&gt;
+ <br>In the first situation (A) the value would be evaluated to the stack as a <tt>java.lang.String</tt> object.
+ And in situation (B) the value would be evaluated to the stack as a <tt>java.lang.Object</tt> object.
+ <br>For more information see <a href="https://issues.apache.org/jira/browse/WW-808">WW-808</a>.
+ </p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/param.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/param/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.Param}
-
+

+```xml
+ <pre>
+ &lt;ui:component&gt;
+  &lt;ui:param name="key"     value="[0]"/&gt;
+  &lt;ui:param name="value"   value="[1]"/&gt;
+  &lt;ui:param name="context" value="[2]"/&gt;
+ &lt;/ui:component&gt;
+ </pre>
+
+ <p>
+ Whether to suppress empty parameters:
+ </p>
+
+ <pre>
+ &lt;s:url action="eventAdd"&gt;
+   &lt;s:param name="bean.searchString" value="%{bean.searchString}" /&gt;
+   &lt;s:param name="bean.filter" value="%{bean.filter}" /&gt;
+   &lt;s:param name="bean.pageNum" value="%{pager.pageNumber}" suppressEmptyParameters="true" /&gt;
+ &lt;/s:url&gt;
+ </pre>
+```
+
+
-
{snippet:id=exampledescription|javadoc=true|url=org.apache.struts2.components.Param}
-
+
 where the key will be the identifier and the value the result of an OGNL expression run against the current
+ ValueStack.
+
diff --git a/content/tag-developers/password-tag.html b/content/tag-developers/password-tag.html index 6a80a13..ee23543 100644 --- a/content/tag-developers/password-tag.html +++ b/content/tag-developers/password-tag.html @@ -140,24 +140,35 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Password}
-
+
 <p>Render an HTML input tag of type password.</p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/password.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/password/html.java;hb=HEAD
+

Examples

-
{snippet:id=exdescription|javadoc=true|lang=none|url=org.apache.struts2.components.Password}
-
+

+```none
+ <p>
+ In this example, a password control is displayed. For the label, we are calling ActionSupport's getText() to
+ retrieve password label from a resource bundle.
+ </p>
+```
+
+
-
{snippet:id=example|javadoc=true|lang=xml|url=org.apache.struts2.components.Password}
-
+

+```xml
+ &lt;s:password label="%{text('password')}" name="password" size="10" maxlength="15" /&gt;
+```
+
+
diff --git a/content/tag-developers/property-tag.html b/content/tag-developers/property-tag.html index cd4f42d..0578064 100644 --- a/content/tag-developers/property-tag.html +++ b/content/tag-developers/property-tag.html @@ -140,24 +140,44 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Property}
-
+
 <p>
+ Used to get the property of a <i>value</i>, which will default to the top of
+ the stack if none is specified.
+ </p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/property.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/property/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.Property}
-
+

+```xml
+
+ &lt;s:push value="myBean"&gt;
+     <!-- Example 1: -->
+     &lt;s:property value="myBeanProperty" /&gt;
+
+     <!-- Example 2: -->TextUtils
+     &lt;s:property value="myBeanProperty" default="a default value" /&gt;
+ &lt;/s:push&gt;
+
+```
+
+
-
{snippet:id=exampledescription|lang=none|javadoc=true|url=org.apache.struts2.components.Property}
-
+

+```none
+ Example 1 prints the result of myBean's getMyBeanProperty() method.
+ Example 2 prints the result of myBean's getMyBeanProperty() method and if it is null, print 'a default value' instead.
+```
+
+
diff --git a/content/tag-developers/push-tag.html b/content/tag-developers/push-tag.html index ee095bd..8479065 100644 --- a/content/tag-developers/push-tag.html +++ b/content/tag-developers/push-tag.html @@ -140,48 +140,102 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Push}
-
+
 <p>Push value on stack for simplified usage.</p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/push.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/push/html.java;hb=HEAD
+

Examples

-
{snippet:id=example1|lang=xml|javadoc=true|url=org.apache.struts2.components.Push}
-
+

+```xml
+ &lt;s:push value="user"&gt;
+     &lt;s:propery value="firstName" /&gt;
+     &lt;s:propery value="lastName" /&gt;
+ &lt;/s:push&gt;
+```
+
+
-
{snippet:id=example1description|lang=none|javadoc=true|url=org.apache.struts2.components.Push}
-
+

+```none
+ Pushed user into the stack, and hence property tag could access user's properties
+ (firstName, lastName etc) since user is now at the top of the stack
+```
+
+
-
{snippet:id=example2|lang=xml|javadoc=true|url=org.apache.struts2.components.Push}
-
+

+```xml
+  &lt;s:push value="myObject"&gt;                              ----- (1)
+       &lt;s:bean name="jp.SomeBean" var="myBean"/&gt;        ----- (2)
+          &lt;s:param name="myParam" value="top"/&gt;        ----- (3)
+       &lt;/s:bean&gt;
+   &lt;/s:push&gt;
+```
+
+
-
{snippet:id=example2description|lang=none|javadoc=true|url=org.apache.struts2.components.Push}
-
+

+```none
+ when in (1), myObject is at the top of the stack
+ when in (2), jp.SomeBean is in the top of stack, also in stack's context with key myBean
+ when in (3), top will get the jp.SomeBean instance
+```
+
+
-
{snippet:id=example3|lang=xml|javadoc=true|url=org.apache.struts2.components.Push}
-
+

+```xml
+ &lt;s:push value="myObject"&gt;                                       ---(A)
+    &lt;s:bean name="jp.SomeBean" var="myBean"/&gt;                   ---(B)
+       &lt;s:param name="myParam" value="top.mySomeOtherValue"/&gt;  ---(C)
+    &lt;/s:bean&gt;
+ &lt;/s:push&gt;
+```
+
+
-
{snippet:id=example3description|lang=none|javadoc=true|url=org.apache.struts2.components.Push}
-
+

+```none
+ when in (A), myObject is at the top of the stack
+ when in (B), jp.SomeBean is at the top of the stack, also in context with key myBean
+ when in (C), top refers to jp.SomeBean instance. so top.mySomeOtherValue would invoke SomeBean's mySomeOtherValue() method
+```
+
+
-
{snippet:id=example4|lang=xml|javadoc=true|url=org.apache.struts2.components.Push}
-
+

+```xml
+ &lt;s:push value="myObject"&gt;                                 ---- (i)
+    &lt;s:bean name="jp.SomeBean" var="myBean"/&gt;             ---- (ii)
+       &lt;s:param name="myParam" value="[1].top"/&gt;         -----(iii)
+    &lt;/s:bean&gt;
+ &lt;/s:push&gt;
+```
+
+
-
{snippet:id=example4description|lang=none|javadoc=true|url=org.apache.struts2.components.Push}
-
+

+```none
+ when in (i), myObject is at the top of the stack
+ when in (ii), jp.SomeBean is at the top of the stack, followed by myObject
+ when in (iii), [1].top will returned top of the cut of stack starting from myObject, namely myObject itself
+```
+
+
diff --git a/content/tag-developers/radio-tag.html b/content/tag-developers/radio-tag.html index 6f2ab7f..5a01466 100644 --- a/content/tag-developers/radio-tag.html +++ b/content/tag-developers/radio-tag.html @@ -138,40 +138,49 @@ - - - - - - - - -
{snippet:id=javadocjavadoc=trueurl=org.apache.struts2.components.ListUIBean}
+

+ Note that the listkey and listvalue attribute will default to "key" and "value" + respectively only when the list attribute is evaluated to a Map or its descendant. + Everything else will result in listkey and listvalue to be null and not used. +

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Radio}
-
+
 <p>Render a radio button input field.</p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/radio.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/radio/html.java;hb=HEAD
+

Examples

-
{snippet:id=exdescription|javadoc=true|url=org.apache.struts2.components.Radio}
-
+
 In this example, a radio control is displayed with a list of genders. The gender list is built from attribute
+ id=genders. The framework calls getGenders() which will return a Map. For examples using listKey and listValue attributes,
+ see the section select tag. The default selected one will be determined (in this case) by the getMale() method
+ in the action class which should return a value similar to the key of the getGenders() map if that particular
+ gender is to be selected.
+
-
{snippet:id=example|javadoc=true|lang=xml|url=org.apache.struts2.components.Radio}
-
+

+```xml
+ &lt;s:action name="GenderMap" var="genders"/&gt;
+ &lt;s:radio label="Gender" name="male" list="#genders.genders"/&gt;
+```
+
+
-
{snippet:id=example_fmt|javadoc=true|lang=xml|url=org.apache.struts2.components.Radio}
-
+

+```xml
+ &lt;@s.radio name="car" list={"ford": "Ford Motor Co", "toyota": "Toyota"} listKey="key" listValue="value" /&gt;
+```
+
+
diff --git a/content/tag-developers/reset-tag.html b/content/tag-developers/reset-tag.html index e247692..abd4c58 100644 --- a/content/tag-developers/reset-tag.html +++ b/content/tag-developers/reset-tag.html @@ -140,28 +140,44 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Reset}
-
+
 Render a reset button. The reset tag is used together with the form tag to provide form resetting.
+ The reset can have two different types of rendering:
+ <ul>
+ <li>input: renders as html &lt;input type="reset"...&gt;</li>
+ <li>button: renders as html &lt;button type="reset"...&gt;</li>
+ </ul>
+ Please note that the button type has advantages by adding the possibility to separate the submitted value from the
+ text shown on the button face, but has issues with Microsoft Internet Explorer at least up to 6.0
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/reset.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/reset/html.java;hb=HEAD
+

Examples

Example 1

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.Reset}
-
+

+```xml
+ &lt;s:reset value="Reset" /&gt;
+```
+
+

Example 2

-
{snippet:id=example2|lang=xml|javadoc=true|url=org.apache.struts2.components.Reset}
-
+

+```xml
+ Render a reset button:
+ &lt;s:reset type="button" key="reset"/&gt;
+```
+
+
diff --git a/content/tag-developers/select-tag.html b/content/tag-developers/select-tag.html index feff66f..4bb28e8 100644 --- a/content/tag-developers/select-tag.html +++ b/content/tag-developers/select-tag.html @@ -140,24 +140,63 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Select}
-
+

+ Render an HTML input tag of type select.
+
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/select.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/select/html.java;hb=HEAD
+

Examples

-
{snippet:id=exnote|javadoc=true|lang=none|url=org.apache.struts2.components.Select}
-
+

+```none
+
+ Note: For any of the tags that use lists (select probably being the most ubiquitous), which uses the OGNL list
+ notation (see the "months" example above), it should be noted that the map key created (in the months example,
+ the '01', '02', etc.) is typed. '1' is a char, '01' is a String, "1" is a String. This is important since if
+ the value returned by your "value" attribute is NOT the same type as the key in the "list" attribute, they
+ WILL NOT MATCH, even though their String values may be equivalent. If they don't match, nothing in your list
+ will be auto-selected.
+
+```
+
+
-
{snippet:id=example|javadoc=true|lang=xml|url=org.apache.struts2.components.Select}
-
+

+```xml
+
+ &lt;s:select label="Pets"
+        name="petIds"
+        list="petDao.pets"
+        listKey="id"
+        listValue="name"
+        multiple="true"
+        size="3"
+        required="true"
+        value="%{petDao.pets.{id}}"
+ /&gt;
+
+ &lt;s:select label="Months"
+        name="months"
+        headerKey="-1" headerValue="Select Month"
+        list="#{'01':'Jan', '02':'Feb', [...]}"
+        value="selectedMonth"
+        required="true"
+ /&gt;
+
+ // The month id (01, 02, ...) returned by the getSelectedMonth() call
+ // against the stack will be auto-selected
+
+```
+
+
diff --git a/content/tag-developers/set-tag.html b/content/tag-developers/set-tag.html index 277c79d..ea49618 100644 --- a/content/tag-developers/set-tag.html +++ b/content/tag-developers/set-tag.html @@ -140,20 +140,47 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Set}
-
+
 <p>The set tag assigns a value to a variable in a specified scope. It is useful when you wish to assign a variable to a
+ complex expression and then simply reference that variable each time rather than the complex expression. This is
+ useful in both cases: when the complex expression takes time (performance improvement) or is hard to read (code
+ readability improvement).</p>
+ <p>If the tag is used with body content, the evaluation of the value parameter is omitted. Instead, the String to
+ which the body evaluates is set as value for the scoped variable.</p>
+
+ <p>The scopes available are as follows:</p>
+ <ul>
+   <li>application - the value will be set in application scope according to servlet spec. using the name as its key</li>
+   <li>session - the value will be set in session scope according to servlet spec. using the name as key </li>
+   <li>request - the value will be set in request scope according to servlet spec. using the name as key </li>
+   <li>page - the value will be set in page scope according to servlet spec. using the name as key</li>
+   <li>action - the value will be set in the request scope and Struts' action context using the name as key</li>
+ </ul>
+
+ <p>
+ NOTE:<br>
+ If no scope is specified, it will default to action scope.
+ </p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/set.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/set/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.Set}
-
+

+```xml
+ &lt;s:set var="personName" value="person.name"/&gt;
+ Hello, &lt;s:property value="#personName"/&gt;
+
+ &lt;s:set var="janesName"&gt;Jane Doe&lt;/s:set&gt;
+ &lt;s:property value="#janesName"/&gt;
+```
+
+
diff --git a/content/tag-developers/sort-tag.html b/content/tag-developers/sort-tag.html index 0984a71..2554209 100644 --- a/content/tag-developers/sort-tag.html +++ b/content/tag-developers/sort-tag.html @@ -140,20 +140,49 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.views.jsp.iterator.SortIteratorTag}
-
+

+ <b>NOTE: JSP-TAG</b>
+
+ <p>A Tag that sorts a List using a Comparator both passed in as the tag attribute.
+ If 'var' attribute is specified, the sorted list will be placed into the PageContext
+ attribute using the key specified by 'var'. The sorted list will ALWAYS be
+ pushed into the stack and poped at the end of this tag.</p>
+
+

Parameters

-
{snippet:id=tagattributes|url=struts2-tags/sort.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/sort/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.views.jsp.iterator.SortIteratorTag}
-
+

+```xml
+
+ USAGE 1:
+ &lt;s:sort comparator="myComparator" source="myList"&gt;
+      &lt;s:iterator&gt;
+      &lt;!-- do something with each sorted elements --&gt;
+      &lt;s:property value="..." /&gt;
+      &lt;/s:iterator&gt;
+ &lt;/s:sort&gt;
+
+ USAGE 2:
+ &lt;s:sort var="mySortedList" comparator="myComparator" source="myList" /&gt;
+
+ &lt;%
+    Iterator sortedIterator = (Iterator) pageContext.getAttribute("mySortedList");
+    for (Iterator i = sortedIterator; i.hasNext(); ) {
+      // do something with each of the sorted elements
+    }
+ %&gt;
+
+```
+
+
diff --git a/content/tag-developers/submit-tag.html b/content/tag-developers/submit-tag.html index da10a65..209708d 100644 --- a/content/tag-developers/submit-tag.html +++ b/content/tag-developers/submit-tag.html @@ -140,8 +140,16 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Submit}
-
+
 Render a submit button. The submit tag is used together with the form tag to provide asynchronous form submissions.
+ The submit can have three different types of rendering:
+ <ul>
+ <li>input: renders as html &lt;input type="submit"...&gt;</li>
+ <li>image: renders as html &lt;input type="image"...&gt;</li>
+ <li>button: renders as html &lt;button type="submit"...&gt;</li>
+ </ul>
+ Please note that the button type has advantages by adding the possibility to seperate the submitted value from the
+ text shown on the button face, but has issues with Microsoft Internet Explorer at least up to 6.0
+
@@ -170,8 +178,8 @@

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/submit.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/submit/html.java;hb=HEAD
+
diff --git a/content/tag-developers/subset-tag.html b/content/tag-developers/subset-tag.html index 397f0e5..5b90f3f 100644 --- a/content/tag-developers/subset-tag.html +++ b/content/tag-developers/subset-tag.html @@ -131,40 +131,123 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.views.jsp.iterator.SubsetIteratorTag}
-
+
 <b>NOTE: JSP-TAG</b>
+
+ <p>A tag that takes an iterator and outputs a subset of it. It delegates to
+ {@link org.apache.struts2.util.SubsetIteratorFilter} internally to
+ perform the subset functionality.</p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/subset.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/subset/html.java;hb=HEAD
+

Examples

-
{snippet:id=action|lang=java|javadoc=true|url=org.apache.struts2.views.jsp.iterator.SubsetIteratorTag}
-
+

+```java
+ public class MySubsetTagAction extends ActionSupport {
+      public String execute() throws Exception {
+         l = new ArrayList();
+         l.add(new Integer(1));
+         l.add(new Integer(2));
+         l.add(new Integer(3));
+         l.add(new Integer(4));
+         l.add(new Integer(5));
+         return "done";
+      }
+
+
+      public Integer[] getMyArray() {
+         return a;
+      }
+
+      public List getMyList() {
+         return l;
+       }
+
+      public Decider getMyDecider() {
+      return new Decider() {
+          public boolean decide(Object element) throws Exception {
+              int i = ((Integer)element).intValue();
+              return (((i % 2) == 0)?true:false);
+          }
+      };
+      }
+  }
+```
+
+
-
{snippet:id=example1|lang=xml|javadoc=true|url=org.apache.struts2.views.jsp.iterator.SubsetIteratorTag}
-
+

+```xml
+ &lt;!-- s: List basic --&gt;
+    &lt;s:subset source="myList"&gt;
+       &lt;s:iterator&gt;
+          &lt;s:property /&gt;
+       &lt;/s:iterator&gt;
+    &lt;/s:subset&gt;
+```
+
+
-
{snippet:id=example2|lang=xml|javadoc=true|url=org.apache.struts2.views.jsp.iterator.SubsetIteratorTag}
-
+

+```xml
+ &lt;!-- B: List with count --&gt;
+    &lt;s:subset source="myList" count="3"&gt;
+       &lt;s:iterator&gt;
+           &lt;s:property /&gt;
+       &lt;/s:iterator&gt;
+     &lt;/s:subset&gt;
+```
+
+
-
{snippet:id=example3|lang=xml|javadoc=true|url=org.apache.struts2.views.jsp.iterator.SubsetIteratorTag}
-
+

+```xml
+ &lt;!--  C: List with start --&gt;
+      &lt;s:subset source="myList" count="13" start="3"&gt;
+         &lt;s:iterator&gt;
+           &lt;s:property /&gt;
+         &lt;/s:iterator&gt;
+      &lt;/s:subset&gt;
+```
+
+
-
{snippet:id=example4|lang=xml|javadoc=true|url=org.apache.struts2.views.jsp.iterator.SubsetIteratorTag}
-
+

+```xml
+ &lt;!--  D: List with var --&gt;
+      &lt;s:subset var="mySubset" source="myList" count="13" start="3" /&gt;
+      &lt;%
+          Iterator i = (Iterator) pageContext.getAttribute("mySubset");
+          while(i.hasNext()) {
+      %&gt;
+      &lt;%=i.next() %&gt;
+      &lt;%  } %&gt;
+```
+
+
-
{snippet:id=example5|lang=xml|javadoc=true|url=org.apache.struts2.views.jsp.iterator.SubsetIteratorTag}
-
+

+```xml
+  &lt;!--  D: List with Decider --&gt;
+      &lt;s:subset source="myList" decider="myDecider"&gt;
+             &lt;s:iterator&gt;
+                  &lt;s:property /&gt;
+             &lt;/s:iterator&gt;
+      &lt;/s:subset&gt;
+```
+
+
diff --git a/content/tag-developers/text-tag.html b/content/tag-developers/text-tag.html index 1b408d2..3761abd 100644 --- a/content/tag-developers/text-tag.html +++ b/content/tag-developers/text-tag.html @@ -140,26 +140,64 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Text}
-
+
 <p>
+ Render a I18n text message.
+ </p>
+
+ <p>
+ The message must be in a resource bundle
+ with the same name as the action that it is associated with. In practice
+ this means that you should create a properties file in the same package
+ as your Java class with the same name as your class, but with .properties
+ extension.
+ </p>
+
+ <p>
+ If the named message is not found in a property file, then the body of the
+ tag will be used as default message. If no body is used, then the stack can
+ be searched, and if a value is returned, it will written to the output.
+ If no value is found on the stack, the key of the message will be written out.
+ </p>
+

For more details on using resource bundles with Struts 2 read the localization guide .

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/text.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/text/html.java;hb=HEAD
+

Examples

-
{snippet:id=exdescription|lang=none|javadoc=true|url=org.apache.struts2.components.Text}
-
+

+```none
+ <p>Accessing messages from a given bundle (the i18n Shop example bundle in the first example) and using bundle defined through the framework in the second example.</p>
+```
+
+
-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.Text}
-
+

+```xml
+
+ &lt;!-- First Example --&gt;
+ &lt;s:i18n name="struts.action.test.i18n.Shop"&gt;
+     &lt;s:text name="main.title"/&gt;
+ &lt;/s:i18n&gt;
+
+ &lt;!-- Second Example --&gt;
+ &lt;s:text name="main.title" /&gt;
+
+ &lt;!-- Third Examlpe --&gt;
+ &lt;s:text name="i18n.label.greetings"&gt;
+    &lt;s:param &gt;Mr Smith&lt;/s:param&gt;
+ &lt;/s:text&gt;
+
+```
+
+

Other example

diff --git a/content/tag-developers/textarea-tag.html b/content/tag-developers/textarea-tag.html index b934801..5e81123 100644 --- a/content/tag-developers/textarea-tag.html +++ b/content/tag-developers/textarea-tag.html @@ -140,20 +140,24 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.TextArea}
-
+
 <p>Render HTML textarea tag.</p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/textarea.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/textarea/html.java;hb=HEAD
+

Example

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.TextArea}
-
+

+```xml
+ &lt;s:textarea label="Comments" name="comments" cols="30" rows="8"/&gt;
+```
+
+
diff --git a/content/tag-developers/textfield-tag.html b/content/tag-developers/textfield-tag.html index f05966f..b88b340 100644 --- a/content/tag-developers/textfield-tag.html +++ b/content/tag-developers/textfield-tag.html @@ -140,24 +140,32 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.TextField}
-
+
 <p>Render an HTML input field of type text</p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/textfield.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/textfield/html.java;hb=HEAD
+

Examples

-
{snippet:id=exdescription|lang=none|javadoc=true|url=org.apache.struts2.components.TextField}
-
+

+```none
+ In this example, a text control for the "user" property is rendered. The label is also retrieved from a ResourceBundle via the key attribute.
+```
+
+
-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.TextField}
-
+

+```xml
+ &lt;s:textfield key="user" /&gt;
+```
+
+
diff --git a/content/tag-developers/token-tag.html b/content/tag-developers/token-tag.html index 74de20e..b2004be 100644 --- a/content/tag-developers/token-tag.html +++ b/content/tag-developers/token-tag.html @@ -140,20 +140,29 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.Token}
-
+
 <p>Stop double-submission of forms.</p>
+
+ <p>
+ The token tag is used to help with the "double click" submission problem. It is needed if you are using the
+ TokenInterceptor or the TokenSessionInterceptor. The s:token tag merely places a hidden element that contains
+ the unique token.</p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/token.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/token/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|javadoc=true|lang=xml|url=org.apache.struts2.components.Token}
-
+

+```xml
+ &lt;s:token /&gt;
+```
+
+
diff --git a/content/tag-developers/updownselect-tag.html b/content/tag-developers/updownselect-tag.html index 8e1e6b7..f2568da 100644 --- a/content/tag-developers/updownselect-tag.html +++ b/content/tag-developers/updownselect-tag.html @@ -138,32 +138,58 @@
- - - - - - - - -
{snippet:id=javadocjavadoc=trueurl=org.apache.struts2.components.ListUIBean}
+

+ Note that the listkey and listvalue attribute will default to "key" and "value" + respectively only when the list attribute is evaluated to a Map or its descendant. + Everything else will result in listkey and listvalue to be null and not used. +

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.UpDownSelect}
-
+
 <p>
+ Create a Select component with buttons to move the elements in the select component
+ up and down. When the containing form is submited, its elements will be submitted in
+ the order they are arranged (top to bottom).
+ </p>
+

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/updownselect.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/updownselect/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.UpDownSelect}
-
+

+```xml
+
+ &lt;!-- Example 1: simple example --&gt;
+ &lt;s:updownselect
+ list="#{'england':'England', 'america':'America', 'germany':'Germany'}"
+ name="prioritisedFavouriteCountries"
+ headerKey="-1"
+ headerValue="--- Please Order Them Accordingly ---"
+ emptyOption="true" /&gt;
+
+ &lt;!-- Example 2: more complex example --&gt;
+ &lt;s:updownselect
+ list="defaultFavouriteCartoonCharacters"
+ name="prioritisedFavouriteCartoonCharacters"
+ headerKey="-1"
+ headerValue="--- Please Order ---"
+ emptyOption="true"
+ allowMoveUp="true"
+ allowMoveDown="true"
+ allowSelectAll="true"
+ moveUpLabel="Move Up"
+ moveDownLabel="Move Down"
+ selectAllLabel="Select All" /&gt;
+
+```
+
+
diff --git a/content/tag-developers/url-tag.html b/content/tag-developers/url-tag.html index aca13cb..7d7cee2 100644 --- a/content/tag-developers/url-tag.html +++ b/content/tag-developers/url-tag.html @@ -149,8 +149,28 @@

Description

-
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.components.URL}
-
+

+ <p>This tag is used to create a URL.</p>
+
+ <p>You can use the &lt;param&gt; tag inside the body to provide
+ additional request parameters. If the value of a param is an Array or
+ an Iterable all the values will be added to the URL.</p>
+
+ <b>NOTE:</b>
+ <p>By default request parameters will be separated using escaped ampersands (i.e., &amp;amp;).
+ This is necessary for XHTML compliance, however, when using the URL generated by this tag
+ with the &lt;s:property&gt; tag, the <b>escapeAmp</b> attribute should be used to disable
+ ampersand escaping.</p>
+
+ <b>NOTE:</b>
+ <p>When includeParams is 'all' or 'get', the parameter defined in a &lt;param&gt;
+ tag will take precedence over any params included due to the includeParams attribute. For
+ example, in Example 3 below, if there is a id parameter in the url where the page this
+ tag is included like http://&lt;host&gt;:&lt;port&gt;/&lt;context&gt;/editUser.action?id=3333&amp;name=John
+ the generated url will be http://&lt;host&gt;:&lt;port&gt;/&lt;context&gt;/editUser.action?id=22&amp;name=John
+ because the parameter defined in the param tag will take precedence.</p>
+
+

Setting a default value for includeParams

@@ -189,14 +209,33 @@

Parameters

-
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/url.html}
-
+
START SNIPPET: tagattributes not found in https://gitbox.apache.org/repos/asf?p=struts.git;a=blob_plain;f=core/src/main/java/struts2-tags/url/html.java;hb=HEAD
+

Examples

-
{snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.URL}
-
+

+```xml
+
+ &lt;-- Example 1 --&gt;
+ &lt;s:url value="editGadget.action"&gt;
+     &lt;s:param name="id" value="%{selected}" /&gt;
+ &lt;/s:url&gt;
+
+ &lt;-- Example 2 --&gt;
+ &lt;s:url action="editGadget"&gt;
+     &lt;s:param name="id" value="%{selected}" /&gt;
+ &lt;/s:url&gt;
+
+ &lt;-- Example 3--&gt;
+ &lt;s:url includeParams="get"&gt;
+     &lt;s:param name="id" value="%{'22'}" /&gt;
+ &lt;/s:url&gt;
+
+```
+
+
-- To stop receiving notification emails like this one, please contact ['"commits@struts.apache.org" '].