my dog learned polymorphism*
The moose likes Struts and the fly likes Struts 2 + hibernate + validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 + hibernate + validation" Watch "Struts 2 + hibernate + validation" New topic
Author

Struts 2 + hibernate + validation

vanlalhmangaiha khiangte
Ranch Hand

Joined: Sep 11, 2006
Posts: 170
Hi all,
I am currently doing the tutorial CRUD example http://www.vaannila.com/struts-2/struts-2-example/struts-2-crud-example-1.html , this is integrating STRUTS2+HIBERNATE
In this tutorial , in struts.xml
In struts we can do validation in xml as shown in this tutorial http://www.vaannila.com/struts-2/struts-2-example/struts-2-validation-using-xml-example-1.html , for struts validation , in struts.xml
We can do Hibernate Validation as shown in this tutorial http://www.vaannila.com/struts-2/struts-2-tutorial/struts-2-hibernate-validation-tutorial-1.html

So my question is this
1. In CRUD example http://www.vaannila.com/struts-2/struts-2-example/struts-2-crud-example-1.html ,
I want to add struts validation as shown in http://www.vaannila.com/struts-2/struts-2-example/struts-2-validation-using-xml-example-1.html
Is this possible in struts.xml,

I have tried it,it is not working.

2. What is the best way to include struts-validation in the CRUD example


Thanks in advance,
Vanlal >
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8971
    
    9

The Struts Documentation says that the package element's extends attribute can contain "one or more previous packages", though I would put money on the hibernate-default package already extending struts-default. If I could find it. I downloaded the tutorial source and no luck.
Did you notice you have a double-quote out of place in your declaration?


[How To Ask Questions On JavaRanch]
vanlalhmangaiha khiangte
Ranch Hand

Joined: Sep 11, 2006
Posts: 170
Did you notice you have a double-quote out of place in your declaration?

Copy and paste error ...
Well got the answer for this .. we have to do it through hibernate ... we have to do this through interceptors ..
Volodymyr Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 505
    
    1

I use hibernate 3 and struts 2. I use struts2-fullhibernatecore-plugin.

My struts.xml is simple:

My entity is also simple:

Next is my action class that uses @javax.validation.VAlid annotation to trigger hibernate constraints.

Can you tell what interceptors I am missing ?

Thank you!


True person is moral, false is right!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Struts 2 + hibernate + validation