[struts-site] branch master updated: Cleans up Ajax based 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 The following commit(s) were added to refs/heads/master by this push: new 6116df3 Cleans up Ajax based validation 6116df3 is described below commit 6116df31b38e20e53bc88ff38cbbb961518ca0ec Author: Lukasz Lenart AuthorDate: Wed Jan 20 09:18:25 2021 +0100 Cleans up Ajax based validation --- .../core-developers/ajax-client-side-validation.md | 222 + .../attachments/struts2-ajax-vali-flow.png | Bin 0 -> 54364 bytes source/core-developers/client-side-validation.md | 2 +- .../pure-java-script-client-side-validation.md | 9 +- 4 files changed, 100 insertions(+), 133 deletions(-) diff --git a/source/core-developers/ajax-client-side-validation.md b/source/core-developers/ajax-client-side-validation.md index 7bf3c37..27a7f62 100644 --- a/source/core-developers/ajax-client-side-validation.md +++ b/source/core-developers/ajax-client-side-validation.md @@ -1,37 +1,45 @@ --- layout: core-developers title: AJAX Client Side Validation +parent: + title: Client Side Validation + url: client-side-validation --- # AJAX Client Side Validation +{:.no_toc} +* Will be replaced with the ToC, excluding a header +{:toc} -This validation mode only works with the _ajax theme_ +## Description -| +AJAX-based client side validation improves upon [Pure JavaScript Client Side Validation](pure-java-script-client-side-validation) +by using a combination of JavaScript, DOM manipulation, and remote server communication. Unlike the pure client side +implementation, AJAX-based validation communicates with the server. This means all your validation rules that worked +when submitting a form will still work within the browser. -AJAX\-based client side validation improves upon [Pure JavaScript Client Side Validation](#PAGE_14262) by using a combination of JavaScript, DOM manipulation, and remote server communication\. Unlike the pure client side implementation, AJAX\-based validation communicates with the server\. This means all your validation rules that worked when submitting a form will still work within the browser\. +The validation occurs on each **onblur** event for each form element. As each user types in some values and moves to +the next form element, the value (and all other values previously entered) will be sent to the server for validation. +The entire validation stack is run, including visitor validators and your action's `validate()` method. -The validation occurs on each **onblur** event for each form element\. As each user types in some values and moves to the next form element, the value (and all other values previously entered) will be sent to the server for validation\. The entire validation stack is run, including visitor validators and your action's validate() method\. +If there is an error, like the pure implementation, the HTML and DOM will be updated immediately. -If there is an error, like the pure implementation, the HTML and DOM will be updated immediately\. +## AJAX Validation -For an example of this, see _AJAX Validation_ \. +Struts provides [client side validation](client-side-validation)(using JavaScript) for a few validators. Using AJAX +validation, all [validators](validation#bundled-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](../plugins/json/) (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. -__AJAX Validation__ - - -__Description__ - -Struts provides [client side validation](client-side-validation.html)(using JavaScript) for a few validators\. Using AJAX validation, all [validators](#PAGE_14292) 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_ (an interceptor and a result)\. Client side must be handled by applictions themself\. One reason for that is there are too ma [...] - -__Example__ - -This example is taken from the Struts showcase application\. - -__Create the action class__ +## Example +This example is taken from the Struts Showcase Application. +### Create the action class ```java public class AjaxFormSubmitAction extends ActionSupport { @@ -128,16 +136,13 @@ public class AjaxFormSubmitAction extends ActionSupport {
[struts-site] branch asf-site updated: Automatic Site Publish by Buildbot
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 236b7c4 Automatic Site Publish by Buildbot 236b7c4 is described below commit 236b7c45b094e47cdf0c4163442200e93776cc10 Author: buildbot AuthorDate: Wed Jan 20 08:19:16 2021 + Automatic Site Publish by Buildbot --- .../ajax-client-side-validation.html | 242 + .../attachments/struts2-ajax-vali-flow.png | Bin 0 -> 54364 bytes output/core-developers/client-side-validation.html | 2 +- .../pure-java-script-client-side-validation.html | 16 +- 4 files changed, 102 insertions(+), 158 deletions(-) diff --git a/output/core-developers/ajax-client-side-validation.html b/output/core-developers/ajax-client-side-validation.html index a5a06c4..26edf33 100644 --- a/output/core-developers/ajax-client-side-validation.html +++ b/output/core-developers/ajax-client-side-validation.html @@ -129,36 +129,53 @@ << back to Core Developers Guide https://github.com/apache/struts-site/edit/master/source/core-developers/ajax-client-side-validation.md"; title="Edit this page on GitHub">Edit on GitHub -AJAX Client Side Validation - -This validation mode only works with the ajax theme +AJAX Client Side Validation + + + Description + AJAX Validation + Example + Create the action class + Map the Action + Create the JSP + Custom Theme + CSS + JavaScript + How it works + JSONValidationInterceptor parameters + Flow chart of AJAX validation + + + - - - - - - +Description -AJAX-based client side validation improves upon Pure JavaScript Client Side Validation by using a combination of JavaScript, DOM manipulation, and remote server communication. Unlike the pure client side implementation, AJAX-based validation communicates with the server. This means all your validation rules that worked when submitting a form will still work within the browser. +AJAX-based client side validation improves upon Pure JavaScript Client Side Validation +by using a combination of JavaScript, DOM manipulation, and remote server communication. Unlike the pure client side +implementation, AJAX-based validation communicates with the server. This means all your validation rules that worked +when submitting a form will still work within the browser. -The validation occurs on each onblur event for each form element. As each user types in some values and moves to the next form element, the value (and all other values previously entered) will be sent to the server for validation. The entire validation stack is run, including visitor validators and your action’s validate() method. +The validation occurs on each onblur event for each form element. As each user types in some values and moves to +the next form element, the value (and all other values previously entered) will be sent to the server for validation. +The entire validation stack is run, including visitor validators and your action’s validate() method. If there is an error, like the pure implementation, the HTML and DOM will be updated immediately. -For an example of this, see AJAX Validation . - -AJAX Validation +AJAX Validation -Description +Struts provides 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 (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. -Struts provides 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 (an interceptor and a result). Client side must be handled by applictions themself. One reason [...] +Example -Example +This example is taken from the Struts Showcase Application. -This example is taken from the Struts showcase application. - -Create the action class +Create the action class public class AjaxFormSubmitAction extends ActionSupport { private String requiredValidatorField = null; @@ -254,14 +271,12 @@ } - +Map the Action -Map the Acti
Buildbot success in on jekyll_websites
The Buildbot has detected a passing build on builder jekyll_websites while building struts. Full details are available at: https://ci2.apache.org/#builders/7/builds/348 Buildbot URL: https://ci2.apache.org/ Worker for this Build: bb_slave10_ubuntu Build Reason: Triggered jekyll auto-build via .asf.yaml by lukaszlenart Blamelist: asfinfra, commits@struts.apache.org Build succeeded! Sincerely, -The Buildbot
[struts-site] branch master updated: Uses proper layout
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 67150de Uses proper layout 67150de is described below commit 67150de62e21db81659c5ba7c307817bb6365113 Author: Lukasz Lenart AuthorDate: Wed Jan 20 09:23:55 2021 +0100 Uses proper layout --- source/core-developers/ajax-client-side-validation.md | 6 +++--- source/core-developers/client-side-validation.md | 4 ++-- source/core-developers/pure-java-script-client-side-validation.md | 8 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/source/core-developers/ajax-client-side-validation.md b/source/core-developers/ajax-client-side-validation.md index 27a7f62..139013a 100644 --- a/source/core-developers/ajax-client-side-validation.md +++ b/source/core-developers/ajax-client-side-validation.md @@ -1,5 +1,5 @@ --- -layout: core-developers +layout: default title: AJAX Client Side Validation parent: title: Client Side Validation @@ -204,8 +204,8 @@ _jsonActionRedirect_ result mentioned above the action will be executed while AJ JSON providing a new URL to load. Otherwise the AJAX response will be empty and the form must be submitted a 2nd time but as usual request, not AJAX. -| Setting _validate_ to _true_ in the _form_ tag will enable client side, JavaScript validation, which can be used along - with AJAX validation (runs before the AJAX validation). +> Setting _validate_ to _true_ in the _form_ tag will enable client side, JavaScript validation, which can be used along +> with AJAX validation (runs before the AJAX validation). ### Custom Theme diff --git a/source/core-developers/client-side-validation.md b/source/core-developers/client-side-validation.md index 28f0d8b..314499b 100644 --- a/source/core-developers/client-side-validation.md +++ b/source/core-developers/client-side-validation.md @@ -2,8 +2,8 @@ layout: default title: Client Side Validation parent: -title: Validation -url: validation.html + title: Validation + url: validation --- # Client Side Validation diff --git a/source/core-developers/pure-java-script-client-side-validation.md b/source/core-developers/pure-java-script-client-side-validation.md index 451c19e..43fde3e 100644 --- a/source/core-developers/pure-java-script-client-side-validation.md +++ b/source/core-developers/pure-java-script-client-side-validation.md @@ -1,5 +1,5 @@ --- -layout: core-developers +layout: default title: Pure JavaScript Client Side Validation parent: title: Client Side Validation @@ -38,9 +38,9 @@ Because client side validation does not talk to the server, the theme (_xhtml th for properly manipulating the HTML DOM to display the error message inline. The JavaScript that is responsible for doing this logic is `validation.js` and can be found in each theme. -| Errors are reported using the default validation message, not the internationalized version that the server-side might - be aware of. This is a known issue. You may want to try the [AJAX Client Side Validation](ajax-client-side-validation) - for messages that are fully internationalized. +> Errors are reported using the default validation message, not the internationalized version that the server-side might +> be aware of. This is a known issue. You may want to try the [AJAX Client Side Validation](ajax-client-side-validation) +> for messages that are fully internationalized. ## Additional Validator Support
[struts-site] branch asf-site updated: Automatic Site Publish by Buildbot
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 4e0ece6 Automatic Site Publish by Buildbot 4e0ece6 is described below commit 4e0ece69c304b2c44b8d4c14a9a354adf88e3079 Author: buildbot AuthorDate: Wed Jan 20 08:24:46 2021 + Automatic Site Publish by Buildbot --- output/core-developers/ajax-client-side-validation.html | 10 +++--- output/core-developers/client-side-validation.html | 2 +- .../pure-java-script-client-side-validation.html | 12 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/output/core-developers/ajax-client-side-validation.html b/output/core-developers/ajax-client-side-validation.html index 26edf33..9c54b93 100644 --- a/output/core-developers/ajax-client-side-validation.html +++ b/output/core-developers/ajax-client-side-validation.html @@ -127,8 +127,10 @@ -<< back to Core Developers Guide https://github.com/apache/struts-site/edit/master/source/core-developers/ajax-client-side-validation.md"; title="Edit this page on GitHub">Edit on GitHub + +<< back to Client Side Validation + AJAX Client Side Validation @@ -339,8 +341,10 @@ arrive later via AJAX it is necessary to have error-container elements in DOM al JSON providing a new URL to load. Otherwise the AJAX response will be empty and the form must be submitted a 2nd time but as usual request, not AJAX. -| Setting validate to true in the form tag will enable client side, JavaScript validation, which can be used along - with AJAX validation (runs before the AJAX validation). + + Setting validate to true in the form tag will enable client side, JavaScript validation, which can be used along + with AJAX validation (runs before the AJAX validation). + Custom Theme diff --git a/output/core-developers/client-side-validation.html b/output/core-developers/client-side-validation.html index fbbb8a1..0bc7c98 100644 --- a/output/core-developers/client-side-validation.html +++ b/output/core-developers/client-side-validation.html @@ -129,7 +129,7 @@ https://github.com/apache/struts-site/edit/master/source/core-developers/client-side-validation.md"; title="Edit this page on GitHub">Edit on GitHub -<< back to Validation +<< back to Validation Client Side Validation diff --git a/output/core-developers/pure-java-script-client-side-validation.html b/output/core-developers/pure-java-script-client-side-validation.html index 33522ad..394b339 100644 --- a/output/core-developers/pure-java-script-client-side-validation.html +++ b/output/core-developers/pure-java-script-client-side-validation.html @@ -127,8 +127,10 @@ -<< back to Core Developers Guide https://github.com/apache/struts-site/edit/master/source/core-developers/pure-java-script-client-side-validation.md"; title="Edit this page on GitHub">Edit on GitHub + +<< back to Client Side Validation + Pure JavaScript Client Side Validation @@ -167,9 +169,11 @@ some values will be considered acceptable by the JavaScript code but will be mar for properly manipulating the HTML DOM to display the error message inline. The JavaScript that is responsible for doing this logic is validation.js and can be found in each theme. -| Errors are reported using the default validation message, not the internationalized version that the server-side might - be aware of. This is a known issue. You may want to try the AJAX Client Side Validation - for messages that are fully internationalized. + + Errors are reported using the default validation message, not the internationalized version that the server-side might +be aware of. This is a known issue. You may want to try the AJAX Client Side Validation +for messages that are fully internationalized. + Additional Validator Support
Buildbot success in on jekyll_websites
The Buildbot has detected a passing build on builder jekyll_websites while building struts. Full details are available at: https://ci2.apache.org/#builders/7/builds/349 Buildbot URL: https://ci2.apache.org/ Worker for this Build: bb_slave10_ubuntu Build Reason: Triggered jekyll auto-build via .asf.yaml by lukaszlenart Blamelist: asfinfra, commits@struts.apache.org Build succeeded! Sincerely, -The Buildbot