| Author |
validation in struts2 annotation
|
shekhar john
Ranch Hand
Joined: Feb 02, 2011
Posts: 34
|
|
hello ,
i m new to struts2 framework .i m tring to validate my login form with validation annotation,but @validation is depritiated.
i search it so much but all examples are with @validation but it is now depritated so please any body help me to apply validation with annotation.
|
 |
pooja par
Ranch Hand
Joined: Feb 14, 2011
Posts: 31
|
|
@validation is not depriciated
the below link may help you
http://www.roseindia.net/struts/struts2/Struts2-annotations.shtml
this may also help you
http://www.javahowto.net/struts2/how-to-validate-through-annotations-struts-2/
the 1st 2 points are important from the above link.. you may be missing them.
Assure that you're using defaultStack interceptor stack because inside it are workflow and validation interceptors that are responsible of execute validation logic and redirect to appropiate result when validation triggers.Define a result named "input" in action's declaration on struts.xml . This is the result where validation must redirect automatically if exists validation errors. If input result is not defined it will give an error of result not found.
|
 |
shekhar john
Ranch Hand
Joined: Feb 02, 2011
Posts: 34
|
|
thanks a lot pooja .
Actually my eclipse is showing it @Validation and that's why i was confused .i tried it with your url and it is working.
thanks once again
|
 |
Arne Olaf Godtland
Greenhorn
Joined: Mar 22, 2011
Posts: 2
|
|
Actually, @Validation is deprecated, if you are annotating the method and not the class. Use the interface @Validations.
I think this example is excellent:
Apache Struts 2 Documentation - Validation Annotation
I also recommend chapter 10 (Exploring the validation framework) in the book Manning - Struts 2 in action, where it is well explained how you create your own custom validators.
Remember that Struts2 validation is based on XWork framework. So when you are searching for anwers, you may search for XWork as well.
XWork
|
 |
 |
|
|
subject: validation in struts2 annotation
|
|
|