Skip to main content

Field Validation in JSF

Posted by daniel on November 4, 2003 at 3:55 PM EST

Separating business and presentation is a recurring theme. In a web application you want to give the users quick feedback if they enter invalid data but you do not want to burden the page designer with coding this logic in.

In today's featured Weblogs , John Reynolds shares his Field Validation Thoughts. He begins with an example from work that includes code written in

everything from COBOL to Java. We’ve got desktop based applications, browser based applications, mainframe batch processes, stored procedures and web services. The one business requirement that is common among these applications is this; the rules that govern what constitutes valid input for a specific form must always be the same.

This is by no means a unique situation. For example, the rules governing an IRS Form 10-40ez don’t change just because you’re using the web-based Turbo Tax rather then the desktop edition.

It may seem that many of John's concerns have been addressed in JavaServer Faces but he feels "that the current design of the JSF validation tags assigns the responsibility for defining field validations to the page author." This means that the person responsible for the look of the page has to figure out which validation tag to select. Reynolds writes

I am not concerned that field validation is performed in the presentation layer. Validation should generally occur as close to the user as possible to provide the best possible feedback when an error is detected. I am concerned that validation is defined in the presentation layer.

Hans Muller post tackles an issue much harder than field validation. In Teach the Children Well , Hans puts it plainly:

Growing the Java developer base is important. We can rely on classroom instruction for some of that growth, and the migration of experienced programmers for some more. When I was 14, a PDP-8, Basic, and a Teletype were enchanting despite the fact that learning how to program was strictly do-it-yourself. Today's teenage computer explorer has very different expectations about the process of learning and I don't think we're meeting them. Learning the basics of programming with Java has got to be easier.


I was recently shocked to find how many of my friends connect using wireless and never think about other people intercepting information they think is secure. A little time sitting next to someone with a sniffer is all it takes to convince them that security should be a high priority requirement. Today we In Also in Java Today we link to part one of Faheem Khan's developerWorks article Lock down J2ME applications with Kerboros. Khan explains "the usage model and security requirements of a mobile banking application [and describes] the sequence of Kerberos messages (along with Kerberos data formats) that results in the exchange of cryptographic keys for secure communication between a Kerberos client and an e-bank's server."

We also link to a "Code Camp" download Network Security Concepts Using Java. Although the subtitle implies that the material is only for Solaris or Linux, you will find seven related articles as well as tutorials, problems, and solutions once you expand the download.


In Projects and Communities , the java.net Education and Research community highlights Globalcode Developers Community. Brush up on your Portuguese and check out the tutorials, articles, and other resources under file sharing. The java-net community previews version 3.0 of the Open For Business framework. Visit the OFBiz project and "Use Open For Business to automate your business information and process management in your own unique way by customizing high quality open source applications instead of building everything yourself. "


In today's java.net News Headlines :

Registered users can submit news items for the java.net News Page using our news submission form. All submissions go through an editorial review by news director Steve Mallet before being posted to the site. You can also subscribe to the java.net News RSS feed.


Current and upcoming Java Events:

Registered users can submit event listings for the java.net Events Page using our events submission form. All submissions go through an editorial review before being posted to the site.


This blog is delivered weekdays as the Java Today RSS feed. Once this page is no longer featured as the front page of Java Today it will be archived at http://today.java.net/today/archive/index_11042003.html. You can access other past issues in the java.net Archive.