Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"Struts 2 Design and Programming: A Tutorial" Validation Question

 
Schevus Osborne
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Budi,

From everything I have read, the validation framework for Struts 2 is considerably different from that of Struts 1. The configuration and syntax looks to be much friendlier. Would you consider it to be a total improvement, or are there areas that could still use improving?

Also, how tough is it to write a custom validator within the new framework? Thanks!

- Schevus
 
Budi Kurniawan
Author
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Schevus,

Struts 2 validation is based on the XWork Validation Framework and is as easy to configure as that in Struts 1. I think the validation features are comparable.

Writing a custom validator in Struts 2 is not hard. You just implement the Validator interface that is part of the com.opensymphony.xwork2.validator package or extend a convenience base class. Chapter 7 of my book explains how to write custom validators in detail. There are standard validators that are sufficient in most cases, though.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic