Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-3952

creditCard validator available in Struts 1 missing in Struts 2

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.8
    • Fix Version/s: 2.5.12
    • Component/s: XML Validators
    • Labels:
      None

      Description

      Struts 1 has a creditCard validator. That validator does not exists in Struts 2.
      It would be nice to have also that validator in Struts 2 to allow an easier migration from Struts 1 to Struts 2.

        Issue Links

          Activity

          Hide
          lukaszlenart Lukasz Lenart added a comment -

          Basically, creditCard validator delegates validation to Commons CreditCardValidator

          http://commons.apache.org/validator/api-1.4.0/org/apache/commons/validator/CreditCardValidator.html

          Show
          lukaszlenart Lukasz Lenart added a comment - Basically, creditCard validator delegates validation to Commons CreditCardValidator http://commons.apache.org/validator/api-1.4.0/org/apache/commons/validator/CreditCardValidator.html
          Hide
          rgielen Rene Gielen added a comment -

          Daniel Le Berre
          When doing feature requests, patches are always welcome

          Show
          rgielen Rene Gielen added a comment - Daniel Le Berre When doing feature requests, patches are always welcome
          Hide
          dleberre Daniel Le Berre added a comment -

          I know. But good patches are typically non trivial to write when you do not know the codebase, which is the case for me
          (just using struts2 with my students, not on a daily basis on production app)

          Show
          dleberre Daniel Le Berre added a comment - I know. But good patches are typically non trivial to write when you do not know the codebase, which is the case for me (just using struts2 with my students, not on a daily basis on production app)
          Hide
          rgielen Rene Gielen added a comment -

          Two nice ideas coming to my mind:

          • show your students how to use RegExp validations, taking credit card number as example
          • show your students how to implement custom validators, which is fairly easy

          Re-applying the Struts 1 solution has the downside of introducing a fairly heavy new dependency (commons-validator). On the other hand, maybe some people find it useful to create an externally hosted Struts2 plugin for bridging commons-validator...

          Show
          rgielen Rene Gielen added a comment - Two nice ideas coming to my mind: show your students how to use RegExp validations, taking credit card number as example show your students how to implement custom validators, which is fairly easy Re-applying the Struts 1 solution has the downside of introducing a fairly heavy new dependency (commons-validator). On the other hand, maybe some people find it useful to create an externally hosted Struts2 plugin for bridging commons-validator...
          Hide
          dleberre Daniel Le Berre added a comment -

          I noticed the problem when I moved my exercises for Struts 1 to Struts 2. The point was to promote the use of a framework for common tasks

          Show
          dleberre Daniel Le Berre added a comment - I noticed the problem when I moved my exercises for Struts 1 to Struts 2. The point was to promote the use of a framework for common tasks
          Hide
          lukaszlenart Lukasz Lenart added a comment -

          I think the simplest solution is to use RegexValidator and one of the regex (or all) for given card vendor
          http://www.regular-expressions.info/creditcard.html

          Show
          lukaszlenart Lukasz Lenart added a comment - I think the simplest solution is to use RegexValidator and one of the regex (or all) for given card vendor http://www.regular-expressions.info/creditcard.html
          Hide
          lukaszlenart Lukasz Lenart added a comment -

          Postpoining...

          Show
          lukaszlenart Lukasz Lenart added a comment - Postpoining...
          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user lukaszlenart opened a pull request:

          https://github.com/apache/struts/pull/130

          WW-3952: Credit card validator

          Implements a credit card validator
          WW-3952(https://issues.apache.org/jira/browse/WW-3952)

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/lukaszlenart/struts credit-card-validations

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/struts/pull/130.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #130


          commit 01d710bdf3dace8cf964bcd32d0afe14cf251dc2
          Author: Lukasz Lenart <lukaszlenart@apache.org>
          Date: 2017-04-19T16:05:53Z

          WW-3952 Adds implementation of credit card validator

          commit fc497360bee7084293749f712dec233eb219bbf4
          Author: Lukasz Lenart <lukaszlenart@apache.org>
          Date: 2017-04-19T16:06:17Z

          WW-3952 Adds test to check implementation

          commit 743d27f841ce990ed3153f569f890179bdbb6a37
          Author: Lukasz Lenart <lukaszlenart@apache.org>
          Date: 2017-04-19T16:06:31Z

          WW-3952 Introduces annotation

          commit 0813eaa0c8f446404243fba87cde51a619643cb9
          Author: Lukasz Lenart <lukaszlenart@apache.org>
          Date: 2017-04-19T16:07:16Z

          WW-3952 Extends existing logic to handle credit card validation

          commit eb4fcb4afc79dac03f6ed0780211f98e72a09851
          Author: Lukasz Lenart <lukaszlenart@apache.org>
          Date: 2017-04-19T16:07:38Z

          WW-3952 Updates test to include credit card validation


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user lukaszlenart opened a pull request: https://github.com/apache/struts/pull/130 WW-3952 : Credit card validator Implements a credit card validator WW-3952 ( https://issues.apache.org/jira/browse/WW-3952 ) You can merge this pull request into a Git repository by running: $ git pull https://github.com/lukaszlenart/struts credit-card-validations Alternatively you can review and apply these changes as the patch at: https://github.com/apache/struts/pull/130.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #130 commit 01d710bdf3dace8cf964bcd32d0afe14cf251dc2 Author: Lukasz Lenart <lukaszlenart@apache.org> Date: 2017-04-19T16:05:53Z WW-3952 Adds implementation of credit card validator commit fc497360bee7084293749f712dec233eb219bbf4 Author: Lukasz Lenart <lukaszlenart@apache.org> Date: 2017-04-19T16:06:17Z WW-3952 Adds test to check implementation commit 743d27f841ce990ed3153f569f890179bdbb6a37 Author: Lukasz Lenart <lukaszlenart@apache.org> Date: 2017-04-19T16:06:31Z WW-3952 Introduces annotation commit 0813eaa0c8f446404243fba87cde51a619643cb9 Author: Lukasz Lenart <lukaszlenart@apache.org> Date: 2017-04-19T16:07:16Z WW-3952 Extends existing logic to handle credit card validation commit eb4fcb4afc79dac03f6ed0780211f98e72a09851 Author: Lukasz Lenart <lukaszlenart@apache.org> Date: 2017-04-19T16:07:38Z WW-3952 Updates test to include credit card validation
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user lukaszlenart commented on the issue:

          https://github.com/apache/struts/pull/130

          This is ready for review

          Show
          githubbot ASF GitHub Bot added a comment - Github user lukaszlenart commented on the issue: https://github.com/apache/struts/pull/130 This is ready for review
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user cnenning commented on the issue:

          https://github.com/apache/struts/pull/130

          I hope the regex is stable 😉

          Show
          githubbot ASF GitHub Bot added a comment - Github user cnenning commented on the issue: https://github.com/apache/struts/pull/130 I hope the regex is stable 😉
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user lukaszlenart commented on the issue:

          https://github.com/apache/struts/pull/130

          > I hope the regex is stable

          What do you mean by that? I have used this http://www.regular-expressions.info/creditcard.html

          Show
          githubbot ASF GitHub Bot added a comment - Github user lukaszlenart commented on the issue: https://github.com/apache/struts/pull/130 > I hope the regex is stable What do you mean by that? I have used this http://www.regular-expressions.info/creditcard.html
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user cnenning commented on the issue:

          https://github.com/apache/struts/pull/130

          How often do credit card companies change their number-patterns in a way that the regex needs to be updated? 'guess it is rare enough.

          Show
          githubbot ASF GitHub Bot added a comment - Github user cnenning commented on the issue: https://github.com/apache/struts/pull/130 How often do credit card companies change their number-patterns in a way that the regex needs to be updated? 'guess it is rare enough.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user lukaszlenart commented on the issue:

          https://github.com/apache/struts/pull/130

          Good question... I have used those random card numbers in tests and looks ok (but we will see) https://www.paypalobjects.com/en_US/vhelp/paypalmanager_help/credit_card_numbers.htm

          Show
          githubbot ASF GitHub Bot added a comment - Github user lukaszlenart commented on the issue: https://github.com/apache/struts/pull/130 Good question... I have used those random card numbers in tests and looks ok (but we will see) https://www.paypalobjects.com/en_US/vhelp/paypalmanager_help/credit_card_numbers.htm
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user cnenning commented on the issue:

          https://github.com/apache/struts/pull/130

          If patterns change users have another reason to upgrade to latest struts 😆

          Show
          githubbot ASF GitHub Bot added a comment - Github user cnenning commented on the issue: https://github.com/apache/struts/pull/130 If patterns change users have another reason to upgrade to latest struts 😆
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user gregh3269 commented on the issue:

          https://github.com/apache/struts/pull/130

          Last time I did some credit card validation, I needed to use a java script version as the payment process obscured the field names by not having the "name" attribute (so it was not obvious when these were sent over https) and I was unable to do server side validation.

          Show
          githubbot ASF GitHub Bot added a comment - Github user gregh3269 commented on the issue: https://github.com/apache/struts/pull/130 Last time I did some credit card validation, I needed to use a java script version as the payment process obscured the field names by not having the "name" attribute (so it was not obvious when these were sent over https) and I was unable to do server side validation.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 01d710bdf3dace8cf964bcd32d0afe14cf251dc2 in struts's branch refs/heads/master from Lukasz Lenart
          [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=01d710b ]

          WW-3952 Adds implementation of credit card validator

          Show
          jira-bot ASF subversion and git services added a comment - Commit 01d710bdf3dace8cf964bcd32d0afe14cf251dc2 in struts's branch refs/heads/master from Lukasz Lenart [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=01d710b ] WW-3952 Adds implementation of credit card validator
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit fc497360bee7084293749f712dec233eb219bbf4 in struts's branch refs/heads/master from Lukasz Lenart
          [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=fc49736 ]

          WW-3952 Adds test to check implementation

          Show
          jira-bot ASF subversion and git services added a comment - Commit fc497360bee7084293749f712dec233eb219bbf4 in struts's branch refs/heads/master from Lukasz Lenart [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=fc49736 ] WW-3952 Adds test to check implementation
          Hide
          lukaszlenart Lukasz Lenart added a comment -

          PR got merged

          Show
          lukaszlenart Lukasz Lenart added a comment - PR got merged
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 743d27f841ce990ed3153f569f890179bdbb6a37 in struts's branch refs/heads/master from Lukasz Lenart
          [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=743d27f ]

          WW-3952 Introduces annotation

          Show
          jira-bot ASF subversion and git services added a comment - Commit 743d27f841ce990ed3153f569f890179bdbb6a37 in struts's branch refs/heads/master from Lukasz Lenart [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=743d27f ] WW-3952 Introduces annotation
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 0813eaa0c8f446404243fba87cde51a619643cb9 in struts's branch refs/heads/master from Lukasz Lenart
          [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=0813eaa ]

          WW-3952 Extends existing logic to handle credit card validation

          Show
          jira-bot ASF subversion and git services added a comment - Commit 0813eaa0c8f446404243fba87cde51a619643cb9 in struts's branch refs/heads/master from Lukasz Lenart [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=0813eaa ] WW-3952 Extends existing logic to handle credit card validation
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit eb4fcb4afc79dac03f6ed0780211f98e72a09851 in struts's branch refs/heads/master from Lukasz Lenart
          [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=eb4fcb4 ]

          WW-3952 Updates test to include credit card validation

          Show
          jira-bot ASF subversion and git services added a comment - Commit eb4fcb4afc79dac03f6ed0780211f98e72a09851 in struts's branch refs/heads/master from Lukasz Lenart [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=eb4fcb4 ] WW-3952 Updates test to include credit card validation
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 9eec07b310b4ac9e99342cfd632293acd2a45d8b in struts's branch refs/heads/master from Lukasz Lenart
          [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=9eec07b ]

          WW-3952 Adds client side validation support

          Show
          jira-bot ASF subversion and git services added a comment - Commit 9eec07b310b4ac9e99342cfd632293acd2a45d8b in struts's branch refs/heads/master from Lukasz Lenart [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=9eec07b ] WW-3952 Adds client side validation support
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 6ef9f7a3aadd1c9dea5ca7a7a5ae350f37e6e96b in struts's branch refs/heads/master from Lukasz Lenart
          [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=6ef9f7a ]

          WW-3952 Fixes test

          Show
          jira-bot ASF subversion and git services added a comment - Commit 6ef9f7a3aadd1c9dea5ca7a7a5ae350f37e6e96b in struts's branch refs/heads/master from Lukasz Lenart [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=6ef9f7a ] WW-3952 Fixes test
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 775d1c8c65e4207e0590b8d7bfb56f0423f89d90 in struts's branch refs/heads/master from Lukasz Lenart
          [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=775d1c8 ]

          WW-3952 introduces credit card validator

          Show
          jira-bot ASF subversion and git services added a comment - Commit 775d1c8c65e4207e0590b8d7bfb56f0423f89d90 in struts's branch refs/heads/master from Lukasz Lenart [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=775d1c8 ] WW-3952 introduces credit card validator
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/struts/pull/130

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/struts/pull/130
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build Struts-JDK7-master #623 (See https://builds.apache.org/job/Struts-JDK7-master/623/)
          WW-3952 Adds implementation of credit card validator (lukaszlenart: rev 01d710bdf3dace8cf964bcd32d0afe14cf251dc2)

          • (add) core/src/main/java/com/opensymphony/xwork2/validator/validators/CreditCardValidator.java
            WW-3952 Adds test to check implementation (lukaszlenart: rev fc497360bee7084293749f712dec233eb219bbf4)
          • (add) core/src/test/java/com/opensymphony/xwork2/validator/validators/CreditCardValidatorTest.java
            WW-3952 Introduces annotation (lukaszlenart: rev 743d27f841ce990ed3153f569f890179bdbb6a37)
          • (add) core/src/main/java/com/opensymphony/xwork2/validator/annotations/CreditCardValidator.java
            WW-3952 Extends existing logic to handle credit card validation (lukaszlenart: rev 0813eaa0c8f446404243fba87cde51a619643cb9)
          • (edit) core/src/main/java/com/opensymphony/xwork2/validator/validators/RegexFieldValidator.java
          • (edit) core/src/main/java/com/opensymphony/xwork2/validator/AnnotationValidationConfigurationBuilder.java
          • (edit) core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validations.java
          • (edit) core/src/test/java/com/opensymphony/xwork2/validator/AnnotationValidationAction.java
          • (edit) core/src/test/resources/validators.xml
            WW-3952 Updates test to include credit card validation (lukaszlenart: rev eb4fcb4afc79dac03f6ed0780211f98e72a09851)
          • (edit) core/src/test/java/com/opensymphony/xwork2/validator/AnnotationValidationConfigurationBuilderTest.java
            WW-3952 Adds client side validation support (lukaszlenart: rev 9eec07b310b4ac9e99342cfd632293acd2a45d8b)
          • (edit) core/src/main/resources/template/xhtml/form-close-validate.ftl
            WW-3952 Fixes test (lukaszlenart: rev 6ef9f7a3aadd1c9dea5ca7a7a5ae350f37e6e96b)
          • (edit) core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-2.txt
          • (edit) core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-24.txt
          • (edit) core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-22.txt
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build Struts-JDK7-master #623 (See https://builds.apache.org/job/Struts-JDK7-master/623/ ) WW-3952 Adds implementation of credit card validator (lukaszlenart: rev 01d710bdf3dace8cf964bcd32d0afe14cf251dc2) (add) core/src/main/java/com/opensymphony/xwork2/validator/validators/CreditCardValidator.java WW-3952 Adds test to check implementation (lukaszlenart: rev fc497360bee7084293749f712dec233eb219bbf4) (add) core/src/test/java/com/opensymphony/xwork2/validator/validators/CreditCardValidatorTest.java WW-3952 Introduces annotation (lukaszlenart: rev 743d27f841ce990ed3153f569f890179bdbb6a37) (add) core/src/main/java/com/opensymphony/xwork2/validator/annotations/CreditCardValidator.java WW-3952 Extends existing logic to handle credit card validation (lukaszlenart: rev 0813eaa0c8f446404243fba87cde51a619643cb9) (edit) core/src/main/java/com/opensymphony/xwork2/validator/validators/RegexFieldValidator.java (edit) core/src/main/java/com/opensymphony/xwork2/validator/AnnotationValidationConfigurationBuilder.java (edit) core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validations.java (edit) core/src/test/java/com/opensymphony/xwork2/validator/AnnotationValidationAction.java (edit) core/src/test/resources/validators.xml WW-3952 Updates test to include credit card validation (lukaszlenart: rev eb4fcb4afc79dac03f6ed0780211f98e72a09851) (edit) core/src/test/java/com/opensymphony/xwork2/validator/AnnotationValidationConfigurationBuilderTest.java WW-3952 Adds client side validation support (lukaszlenart: rev 9eec07b310b4ac9e99342cfd632293acd2a45d8b) (edit) core/src/main/resources/template/xhtml/form-close-validate.ftl WW-3952 Fixes test (lukaszlenart: rev 6ef9f7a3aadd1c9dea5ca7a7a5ae350f37e6e96b) (edit) core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-2.txt (edit) core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-24.txt (edit) core/src/test/resources/org/apache/struts2/views/jsp/ui/Formtag-22.txt

            People

            • Assignee:
              lukaszlenart Lukasz Lenart
              Reporter:
              dleberre Daniel Le Berre
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development