x
Loading
 Loading
Hello, Guest | Login | Register

Users Type the Darndest Things

During his television and writing career, Art Linkletter perfected the art of eliciting unexpected and humorous responses from children. For example, when asked how his parents met, one eight-year-old boy replied, “My father was doing some strange chores for my mother. They won’t tell me what kind.” Indeed, as Linkletter said, “Kids say the darndest things!”

During his television and writing career, Art Linkletter perfected the art of eliciting unexpected and humorous responses from children. For example, when asked how his parents met, one eight-year-old boy replied, “My father was doing some strange chores for my mother. They won’t tell me what kind.” Indeed, as Linkletter said, “Kids say the darndest things!”

Today, if Linkletter were a Web programmer, he’d probably say, “Users type the darndest things!” However, he wouldn’t be laughing. Validating user input — necessary to prevent bad form data from crashing applications, polluting databases, or causing other harmful side effects — is one of the most time-consuming, tedious, and thankless tasks in Web programming.

Thankfully, the new version of Jakarta Struts (described in last month’s issue or available online at http://www.linux-mag.com/2002-03/struts.html) supports an innovative (and arguably easier) way to check user input: the Commons Validator. The Validator allows you to validate form data declaratively, using an external, XML configuration file instead of Java code. By excising validation from your application, you can make changes to your form and to the associated validation method without recompiling your code. Even better, the Validator can be used on any Java project — on or off the Web.

This month, let’s continue looking at Struts 1.1 and take an in-depth look at the Validator. If you don’t have Struts yet, you can download it and its extensive set of documentation from http://jakarta.apache.org/struts.

Doing It the Old-Fashioned Way

Prior to Struts…

Please log in to view this content.

Not Yet a Member?

Register with LinuxMagazine.com and get free access to the entire archive, including:

  • Hands-on Content
  • White Papers
  • Community Features
  • And more.
Already a Member?
Log in!
Username

Password

Remember me

Forgotten your password?
Forgotten your username?
Read More
  1. Helpful Tools for Software Developers
  2. The Github Hall of Fame
  3. Book'em, Github.
  4. This Week on Github: Stupid Ruby Tricks
  5. A Veritable Scatter Shot!
Follow Linux Magazine
Rackspace