Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2007

Tip: Looking for answers? Try searching our database.

Validation in swing using struts-like approach

Thread view: 
sarath - 17 Jul 2007 12:32 GMT
I have a swings application, which includes a lot of validations in
the client side. When ever I add a new functionality to the same, some
of the validations in the applications breaks.
I am looking for validation method like in struts, where we can
mention all the validation scenarios in an XML or a config file, and
the validation happens as mentioned in that file.
It requries that the validations should be done in the client side
rather than the server side (Like in ActionForm in struts)
Is it possible to have such an approach?
Can I use ActionForm itself in some way for the same?

Regards
Sarath
Lew - 17 Jul 2007 13:21 GMT
> I have a swings application,

No, you don't.

Signature

Lew

sarath - 17 Jul 2007 15:30 GMT
> > I have a swings application,
>
> No, you don't.
>
> --
> Lew

First of all i really did not know about multiposting and cross
posting.. thanks for enlightening me on that.
and your tip.. that really worked..

sarath
Lew - 17 Jul 2007 16:15 GMT
> I am looking for validation method like in struts, where we can
> mention all the validation scenarios in an XML or a config file, and
[quoted text clipped - 3 lines]
> Is it possible to have such an approach?
> Can I use ActionForm itself in some way for the same?

I am not aware of a pre-existing framework to permit declarative validation
for Swing, but there may well be one.

I don't think ActionForms from Struts will give you a problem as such,
although you probably should not derive them from a Struts class but instead
use your own interface.  I have done this myself for a few projects, most of
them from before I learned Struts.  What you will not get this way is the
equivalent of the Struts controller servlet, that is, the dispatcher for the
UI event loop.

OTOH, ActionForms aren't inherently connected to declarative validation rules
anyway.  That is something that the Struts framework takes care of; it parses
the validation declarations, including custom validation classes if specified,
in terms of predefined validator interfaces and classes within Struts.  By the
time the controller invokes your ActionForm (or in more universal terms, the
action handler class), it's already loaded a bunch of classes and has methods
to call them to enforce the rules.

Swing itself follows a Model-View-Controller paradigm, same as Struts.  The
rough equivalent to ActionForm is XxxListener.  The EDT (Event Dispatch
Thread) is the equivalent of the Struts controller servlet.

It is likely that rich-client frameworks like Eclipse or Netbeans will give
you declarative validation.  I am not familiar enough with either as a
rich-client platform to say for sure.

Java generally supports property sheets for JavaBeans, so that would let you
define validation via property files.  You still need to define your own
property and value sets, and parse the properties in custom code, but it's not
hard to use beans this way.

Signature

Lew



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.