• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

validate two passwords in struts

 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm new to struts and assigned to web project using struts and ibatis.
I want to validate two input where user must put their new passwords twice, the validation used to check whether the two new password are the same.
Anyone has a clue from where i should start? do i have to use validator framework?
Any feedbacks will be fully appreciated
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not keep it simple and use the ActionForm validate() method. Another alternative is to use JavaScript.

Closing this here and moving to Struts.
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If using Struts 1.2.something (basically when they added validwhen) in the validation.xml for your form:

 
pingkan paula
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've tried using manual validation, but it returned NullPointerException errors, here is the validation code

 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure why you are calling super.validate twice. If posisi_password_baru1 is null, then your code will throw a NullPointerException. You may want to add a check in your code. If you have a "required" check in your xml validation, then you may want to bracket your custom validation code with an " if (errs.isEmpty())" check.

- Brent
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Henry Lowell,

I am using struts 1.2 and I have tried with the example you provide.

My code is like the following

I have three fields
currentpassword
newpassword
confirmpassword

Now I need to compare with new and confirpassword

I have written code like



I did not get any pop up when those two are not same. What would be the mistake in that?

Thanks for your help in advance.
 
For my next feat, I will require a volunteer from the audience! Perhaps this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic