Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

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
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.
    Bookmark Topic Watch Topic
  • New Topic