File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts2 Validation Not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 Validation Not working" Watch "Struts2 Validation Not working" New topic
Author

Struts2 Validation Not working

Vikash Ananda
Ranch Hand

Joined: Oct 12, 2009
Posts: 32
Hi All,

I have been trying to have validation inside my application using tutorials from roseindia and java-x.blogspot.com and based on them I have created small sample application but validations are not working. The source codes are below:

index.jsp


struts.xml


LoginAction-validation.xml


LoginAction.java


Application code and flow is working but username and password validation is not working. One thing I got is that if Action name is LoginAction then validation XML file name should be LoginAction-validation.xml which is true in my case. All jars are there in proper place and have rechecked them from given tutorials and samples.

Configuration:
Win XP
JDK 1.6
Apache Tomcat 6.0

Please let me know where Am i making mistake?
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

I've never seen hibernate-default package before (I need to concentrate on struts more ), but as is given here, the defaultStackHibernate doesn't include Struts validation (instead it uses hibernate validations), so struts validations are not applied to your actions. You'll have to change your showcaseStack and add the validation interceptor to it...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Vikash Ananda
Ranch Hand

Joined: Oct 12, 2009
Posts: 32
Hi Ankit,

Thanks for the info. I removed this line and things worked fine.

<default-interceptor-ref name="showcaseStack"/>

I was not aware if hibernate interceptor could create problem. Thanks for the link also.

Vikash Anand.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts2 Validation Not working
 
Similar Threads
Pop up error while using validation in struts2.0
problems validation.xml in struts 2
Form Validation using xml in struts2
validation using Resource Bundle
problems in validation part of struts 2