• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

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: 17665
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.
 
He's dead Jim. Grab his tricorder. I'll get his wallet and this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic