Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 + hibernate + validation

 
vanlalhmangaiha khiangte
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9280
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
vanlalhmangaiha khiangte
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 Lysenko
Ranch Hand
Posts: 511
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic