It's not a secret anymore!*
The moose likes Struts and the fly likes Struts 2 field validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 field validation" Watch "Struts 2 field validation" New topic
Author

Struts 2 field validation

Ramkumar Subburaj
Ranch Hand

Joined: Sep 07, 2007
Posts: 83
Hello,

I want to validate two password fields in change password m and I have the following in my validation.xml



and in my JSP page source, i get the following Java Script validation code



As youi can see, the Java script validation is not what I except. It is checking only if the field exists and not performing the comparison

Is there anything I am missing

Thanks


SCJP 1.5, SCWCD 1.4.
Hanging between Web Services and EJB
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Ramkumar Subburaj wrote:Is there anything I am missing

Yes:

http://struts.apache.org/2.x/docs/pure-javascript-client-side-validation.html
Ramkumar Subburaj
Ranch Hand

Joined: Sep 07, 2007
Posts: 83
Thanks for the reply.

If I'm not wrong, "fieldexpression" can not be used for client side validation.

If that is the case, is there any way of achieving it or should we go for handwritten java script.
 
 
subject: Struts 2 field validation
 
Similar Threads
Struts2 (2.1.8.1) Checkbox/Radio button validaton
Struts 2 Validation
Multiple field validation in Struts2 Validation using validation.xml file
Annotation in Validation
Struts 2 Integer Validation not working