Even though Swing is not cool anymore (yes, it was back in the day because it was much better than AWT, believe me) and everybody out there is talking about RIA (you could say that Swing is RIA too ;) ) it's not very unlikely that you'd find yourself in the situation you'd to work with it. In fact, it happened to me this year twice.
There a lot of companies out there using Swing (specially financial ones), and even though some of them in the future will change to the "RIA experience" (if one does, everybody else will, yes SOA I'm looking at you ;D ), in the meantime it's good to improve the "Swing experience" :) .
Like I said, I found myself working in a Swing based project, and the first thing I realized (among others) is that the validations and errors messages were hard coded, repeated and spreaded all over the code. One amateur mistake, you'd say but it's not that uncommon.
To prevent that I integrated the "Jakarta Commons Validator" engine that helps you to reuse sets of validations and messages. If you have used Struts, you'd know it for sure.
The thing is that the JCV package does not provide any pluggable validations out of the box (it provides some validations routines to help you out).
I though the best way would be using something like the Struts Validation Plugin, that included many different validations configured by xml but for a standalone application.
So that's what I did. Now you can use the same Struts Validations (same config files, tags etc.. have a look at the Struts guide), but from your Swing application.
Links
Jakarta Commons Validator
Struts Validations Guide
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment