[struts-site] 01/02: Adds missing JSON validation page
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch json-validation in repository https://gitbox.apache.org/repos/asf/struts-site.git commit e20f5ddd4cdc1a54acbb057d31eaff51c7eb7afe Author: Lukasz Lenart AuthorDate: Wed May 15 10:15:58 2019 +0200 Adds missing JSON validation page --- pom.xml| 2 +- source/plugins/json/index.md | 2 +- source/plugins/json/json-validation.md | 507 + source/plugins/json/struts2-ajax-vali-flow.png | Bin 0 -> 54364 bytes 4 files changed, 509 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 1984c3a..caf6162 100644 --- a/pom.xml +++ b/pom.xml @@ -101,7 +101,7 @@ https://cwiki.apache.org/confluence +gfm true -13859 +13850 diff --git a/source/plugins/json/index.md b/source/plugins/json/index.md index 43e016d..14d158d 100644 --- a/source/plugins/json/index.md +++ b/source/plugins/json/index.md @@ -46,7 +46,7 @@ The `setArray` method can take as parameter either a `List`, or any numeric arra `root` attribute must be set on the `JSONInterceptor` when dealing with JSON array. -This plugin also provides _AJAX Validation_. +This plugin also provides [JSON Validation](json-validation). ## Installation diff --git a/source/plugins/json/json-validation.md b/source/plugins/json/json-validation.md new file mode 100644 index 000..0ab0ca4 --- /dev/null +++ b/source/plugins/json/json-validation.md @@ -0,0 +1,507 @@ +--- +layout: plugin +title: JSON plugin +--- + +# JSON Ajax Validation +{:.no_toc} + +* Will be replaced with the ToC, excluding a header +{:toc} + +## Description + +Struts provides [client side validation](../../core-developers/client-side-validation) (using JavaScript) for a few validators. Using AJAX +validation, all _validators_ available to the application on the server side can be used without forcing the page to reload, just to show +validation errors. AJAX validation has a server side, which is in included in [JSON Plugin](index) (an interceptor and a result). Client +side must be handled by applications themself. One reason for that is there are too many JavaScript frameworks and libraries. Struts has +no preference which of them you use. Previous versions of Struts included a client side which was relying on the Dojo JS framework and was +located in Struts Dojo plugin. That has been deprecated for a long time and was eventually removed. + +## Example + +This example is taken from the Struts showcase application. + +### Create the action class + +```java +public class AjaxFormSubmitAction extends ActionSupport { +private String requiredValidatorField = null; +private String requiredStringValidatorField = null; +private Integer integerValidatorField = null; +private Date dateValidatorField = null; +private String emailValidatorField = null; +private String urlValidatorField = null; +private String stringLengthValidatorField = null; +private String regexValidatorField = null; +private String fieldExpressionValidatorField = null; +@Override +public void validate() { +if (hasFieldErrors()) { +addActionError("Errors present!"); +} +} +public Date getDateValidatorField() { +return dateValidatorField; +} +@DateRangeFieldValidator( +min="01/01/1990", +max="01/01/2000", +message="must be a min 01-01-1990 max 01-01-2000 if supplied") +public void setDateValidatorField(Date dateValidatorField) { +this.dateValidatorField = dateValidatorField; +} +public String getEmailValidatorField() { +return emailValidatorField; +} +@EmailValidator(message="must be a valid email if supplied") +public void setEmailValidatorField(String emailValidatorField) { +this.emailValidatorField = emailValidatorField; +} +public Integer getIntegerValidatorField() { +return integerValidatorField; +} +@IntRangeFieldValidator(min="1", max="10", message="must be integer min 1 max 10 if supplied") +public void setIntegerValidatorField(Integer integerValidatorField) { +this.integerValidatorField = integerValidatorField; +} +public String getRegexValidatorField() { +return regexValidatorField; +} +@RegexFieldValidator( +regex="[^<>]+", +message="regexValidatorField must match a regexp (.*\.txt) if specified") +public void setRegexValidatorField(String regexValidatorField) { +this.regexValidatorField = regexValidatorField; +} +public String getRequiredS
[struts-site] 02/02: Adds proper back link
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch json-validation in repository https://gitbox.apache.org/repos/asf/struts-site.git commit fbbef5a5cb759de0cbdb710e00f96226b5912b57 Author: Lukasz Lenart AuthorDate: Wed May 15 10:21:18 2019 +0200 Adds proper back link --- source/plugins/json/json-validation.md | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/plugins/json/json-validation.md b/source/plugins/json/json-validation.md index 0ab0ca4..aecfa86 100644 --- a/source/plugins/json/json-validation.md +++ b/source/plugins/json/json-validation.md @@ -1,6 +1,9 @@ --- layout: plugin -title: JSON plugin +title: JSON Ajax validation +parent: +title: JSON plugin +url: index.html --- # JSON Ajax Validation
[struts-site] branch json-validation created (now fbbef5a)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch json-validation in repository https://gitbox.apache.org/repos/asf/struts-site.git. at fbbef5a Adds proper back link This branch includes the following new commits: new e20f5dd Adds missing JSON validation page new fbbef5a Adds proper back link The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[struts-site] 01/01: Merge pull request #125 from lukaszlenart/json-validation
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/struts-site.git commit 10a1fc7b706b66dce6ae007aee64b625379a3115 Merge: b33a120 fbbef5a Author: Lukasz Lenart AuthorDate: Wed May 15 15:28:59 2019 +0200 Merge pull request #125 from lukaszlenart/json-validation Adds missing JSON validation page pom.xml| 2 +- source/plugins/json/index.md | 2 +- source/plugins/json/json-validation.md | 510 + source/plugins/json/struts2-ajax-vali-flow.png | Bin 0 -> 54364 bytes 4 files changed, 512 insertions(+), 2 deletions(-)
[struts-site] branch master updated (b33a120 -> 10a1fc7)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/struts-site.git. from b33a120 tidying token interceptor pages add e20f5dd Adds missing JSON validation page add fbbef5a Adds proper back link new 10a1fc7 Merge pull request #125 from lukaszlenart/json-validation The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: pom.xml| 2 +- source/plugins/json/index.md | 2 +- .../json/json-validation.md} | 231 - source/plugins/json/struts2-ajax-vali-flow.png | Bin 0 -> 54364 bytes 4 files changed, 92 insertions(+), 143 deletions(-) copy source/{core-developers/ajax-client-side-validation.md => plugins/json/json-validation.md} (65%) create mode 100755 source/plugins/json/struts2-ajax-vali-flow.png
[struts-site] branch asf-site updated: Updates production by Jenkins
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 09967c6 Updates production by Jenkins 09967c6 is described below commit 09967c611882532c1a293c79a2f23835e5d21c12 Author: jenkins AuthorDate: Wed May 15 13:31:10 2019 + Updates production by Jenkins --- content/plugins/json/index.html | 2 +- content/plugins/json/json-validation.html | 701 content/plugins/json/struts2-ajax-vali-flow.png | Bin 0 -> 54364 bytes 3 files changed, 702 insertions(+), 1 deletion(-) diff --git a/content/plugins/json/index.html b/content/plugins/json/index.html index 8f0241f..e26ba9a 100644 --- a/content/plugins/json/index.html +++ b/content/plugins/json/index.html @@ -203,7 +203,7 @@ The setArray method can take as parameter root attribute must be set on the JSONInterceptor when dealing with JSON array. -This plugin also provides AJAX Validation. +This plugin also provides JSON Validation. Installation diff --git a/content/plugins/json/json-validation.html b/content/plugins/json/json-validation.html new file mode 100644 index 000..ad77fd0 --- /dev/null +++ b/content/plugins/json/json-validation.html @@ -0,0 +1,701 @@ + + + + + + + + + + JSON Ajax validation + + + + + + + + + + + + + +http://github.com/apache/struts"; class="github-ribbon"> + https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa.png"; alt="Fork me on GitHub"> + + + + + + + + +Menu +Toggle navigation + + + + + + + + + + +Home + + +Welcome +Download +Releases +Announcements +http://www.apache.org/licenses/";>License +https://www.apache.org/foundation/thanks.html";>Thanks! +https://www.apache.org/foundation/sponsorship.html";>Sponsorship + + + + +Support + + +User Mailing List +https://issues.apache.org/jira/browse/WW";>Issue Tracker +Reporting Security Issues + +https://cwiki.apache.org/confluence/display/WW/Migration+Guide";>Version Notes +https://cwiki.apache.org/confluence/display/WW/Security+Bulletins";>Security Bulletins + +Maven Project Info +Struts Core Dependencies +Plugin Dependencies + + + + +Documentation + + +Birds Eye +Key Technologies +Kickstart FAQ +https://cwiki.apache.org/confluence/display/WW/Home";>Wiki + +Getting Started +Security Guide +Core Developers Guide +Tag Developers Guide +Maven Archetypes +Plugins +Struts Core API +Tag reference +https://cwiki.apache.org/confluence/display/WW/FAQs";>FAQs +http://cwiki.apache.org/S2PLUGINS/home.html";>Plugin registry + + + + +Contributing + + +You at Struts +How to Help FAQ +Development Lists + +Submitting patches +Source Code and Builds +Coding standards +https://cwiki.apache.org/confluence/display/WW/Contributors+Guide";>Contributors Guide + +Release Guidelines +PMC Charter +Volunteers +https://gitbox.apache.org/repos/asf?p=struts.git";>Source Repository + + +http://www.apache.org/";> + + + + + + + + + + +<< back to Plugins +https://github.com/apache/struts-site/edit/master/source/plugins/json/json-validation.md"; title="Edit this page on GitHub">Edit on GitHub +JSON Ajax Validation + + + Description + Example + Create the action class + Map the Action + Create the JSP + Custom Theme + theme.properties + actionerror.ftl + controlfooter.ftl + controlheader-core.ftl + + + CSS + JavaScript + How it works + JSONValidationInterceptor parameters + + + Flow chart of AJAX validation
[struts-site] branch master updated: Fixes layout for plugins to allow define a parent page
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/struts-site.git The following commit(s) were added to refs/heads/master by this push: new 842d7dd Fixes layout for plugins to allow define a parent page 842d7dd is described below commit 842d7ddab287a49c689e8ad380cbe2992cbf3c8d Author: Lukasz Lenart AuthorDate: Thu May 16 08:54:24 2019 +0200 Fixes layout for plugins to allow define a parent page --- source/_layouts/plugin.html | 6 +- source/plugins/json/index.md| 2 +- source/plugins/json/{json-validation.md => json-ajax-validation.md} | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source/_layouts/plugin.html b/source/_layouts/plugin.html index b66ac62..d25b36d 100644 --- a/source/_layouts/plugin.html +++ b/source/_layouts/plugin.html @@ -25,8 +25,12 @@ -<< back to Plugins Edit on GitHub +{% if page.parent %} +<< back to {{ page.parent.title }} +{% else %} +<< back to Plugins +{% endif %} {{ content }} diff --git a/source/plugins/json/index.md b/source/plugins/json/index.md index 14d158d..60970eb 100644 --- a/source/plugins/json/index.md +++ b/source/plugins/json/index.md @@ -46,7 +46,7 @@ The `setArray` method can take as parameter either a `List`, or any numeric arra `root` attribute must be set on the `JSONInterceptor` when dealing with JSON array. -This plugin also provides [JSON Validation](json-validation). +This plugin also provides [JSON Ajax Validation](json-ajax-validation). ## Installation diff --git a/source/plugins/json/json-validation.md b/source/plugins/json/json-ajax-validation.md similarity index 99% rename from source/plugins/json/json-validation.md rename to source/plugins/json/json-ajax-validation.md index aecfa86..80e6218 100644 --- a/source/plugins/json/json-validation.md +++ b/source/plugins/json/json-ajax-validation.md @@ -2,8 +2,8 @@ layout: plugin title: JSON Ajax validation parent: -title: JSON plugin -url: index.html + title: JSON plugin + url: index.html --- # JSON Ajax Validation