• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Types of validations in struts

 
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have three questions.

1). What are the ways we can actually perform validation in struts? I think it's Using validation framework(validation.xml) and the other is in the validate method of the form bean. Am I correct?

2). Can we do validation as mentioned above in both struts 1.1 and struts 2.0?

3). What is Dynavalidation then?

Thanks.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like interview questions.

Validation in S2 is different than in S1.

The docs for DynaValidatorForm (and DynaValidatorActionForm) explain what they are and how they're different.
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by David Newton:
Sounds like interview questions.

Validation in S2 is different than in S1.



Yeah I am preparing for an interview . Is this true guys?? That we can not use validation framework we use in struts 1.0 in struts 2.0?

Thanks.
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've been readin online about using validation framework in Struts 2.0 and these are the changes I basically found from what we do normally in Struts 1.1. Please correct me if I am wrong.

1). Validation.xml file should be named as yourActionClass-Validation.xml
2). Validate=true is written in Jsp form tag
3). Error messages are written in the validation.xml file too within the <message tag> instead of using an Resources file.

Thanks.
[ December 17, 2008: Message edited by: Arjun Reddy ]
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's one way of doing validation in S2, there are others.

The form tag's "validate" attribute is related to client-side validation.

S2 validation messages may be resources, or specified explicitly in the validation XML. You can also validate with annotations.

I'd recommend actually writing some S2 code rather than just "knowing" it by reading the documentation or asking questions--the only way to actually learn something is by doing.
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by David Newton:
That's one way of doing validation in S2, there are others.

The form tag's "validate" attribute is related to client-side validation.

S2 validation messages may be resources, or specified explicitly in the validation XML. You can also validate with annotations.

I'd recommend actually writing some S2 code rather than just "knowing" it by reading the documentation or asking questions--the only way to actually learn something is by doing.



Okie David. Thanks.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic