You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dan Allen <da...@mojavelinux.com> on 2003/03/14 22:47:57 UTC

validate business data

Naturally all screening of data should be done by the
ActionForm/Validator interface, but when it comes time to looking
for duplicate usernames/emails or other such business conflicts,
this must be done in the business logic layer.

How do most of you handle this?  Do you create a validateData()
method in your Action class or is this something that the Model
objects should be able to handle?

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <da...@mojavelinux.com>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Windows: where do you want your data to disappear to today?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: validate business data

Posted by Dan Allen <da...@mojavelinux.com>.
Rick Reumann (r@reumann.net) wrote:

> On Fri, 14 Mar 2003 15:47:57 -0600
> Dan Allen <da...@mojavelinux.com> wrote:
>  
> > How do most of you handle this?  Do you create a validateData()
> > method in your Action class or is this something that the Model
> > objects should be able to handle?
> 
> Assuming you have the data in the correct form when you're action form
> is populated, any other validation I believe should be done in the
> business layer and throw an appropriate Exception which the action can
> then handle.  

Excellent guidance.  I will run with that for sure.

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <da...@mojavelinux.com>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Windows: where do you want your data to disappear to today?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: validate business data

Posted by Rick Reumann <r...@reumann.net>.
On Fri, 14 Mar 2003 15:47:57 -0600
Dan Allen <da...@mojavelinux.com> wrote:
 
> How do most of you handle this?  Do you create a validateData()
> method in your Action class or is this something that the Model
> objects should be able to handle?

Assuming you have the data in the correct form when you're action form
is populated, any other validation I believe should be done in the
business layer and throw an appropriate Exception which the action can
then handle.  

-- 
Rick Reumann

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: validate business data

Posted by Dennis Muhlestein <de...@zserve.com>.
We have a couple different approaches.  But one is to create some custom
validator Fields that can be plugged in to the validator.  Then all
errors, buisiness or otherwise, are done by the DynaValidatorForm.

Makes our actions simpler.

-Dennis

On Fri, 2003-03-14 at 14:47, Dan Allen wrote:
> *This message was transferred with a trial version of CommuniGate(tm) Pro*
> Naturally all screening of data should be done by the
> ActionForm/Validator interface, but when it comes time to looking
> for duplicate usernames/emails or other such business conflicts,
> this must be done in the business logic layer.
> 
> How do most of you handle this?  Do you create a validateData()
> method in your Action class or is this something that the Model
> objects should be able to handle?
> 
> Dan


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: validate business data

Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi,

What we have done in our application is created a
busniess logic bean,
so we create the instance of this bean in Action class
and then get an ArrayList of all the messages ( error
or display) and then put these messages in
ActionErrors in Action class and forward it to jsp
So we keep the business logic and struts totally
independent

Ashish
--- Dan Allen <da...@mojavelinux.com> wrote:
> Naturally all screening of data should be done by
> the
> ActionForm/Validator interface, but when it comes
> time to looking
> for duplicate usernames/emails or other such
> business conflicts,
> this must be done in the business logic layer.
> 
> How do most of you handle this?  Do you create a
> validateData()
> method in your Action class or is this something
> that the Model
> objects should be able to handle?
> 
> Dan
> 
> -- 
> - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - - - - 
> Daniel Allen, <da...@mojavelinux.com>
> http://www.mojavelinux.com/
> - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - - - - 
> Windows: where do you want your data to disappear to
> today?
> - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - - - - 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: validate business data

Posted by Aaron O'Hara <aj...@globalreachsoftware.com>.
Dan,

In order to preserve a layered approach, there are 2 issues:

1) the display of errors
2) evaluating if an error has occurred

In my Struts applications, I have a Business Logic Layer (BLL) that will
always perform 2).  In the Action class, I call the validation function
to check for HTML form errors as well as calling the BLL to check of
business rule errors (such as the duplicate emails).  If an error is
found, my action class will put ensure the error appears on the page
which generated the error.  The displaying of errors usually occurs
through the application platform, so in this case, ensure that the error
message and error handling is done by Struts.

Using this approach, you can re-use your BLL for other applications
without having Struts tie-ins.

Aaron

-----Original Message-----
From: Dan Allen [mailto:dan@mojavelinux.com] 
Sent: Friday, March 14, 2003 1:48 PM
To: Struts-User List
Subject: validate business data

Naturally all screening of data should be done by the
ActionForm/Validator interface, but when it comes time to looking
for duplicate usernames/emails or other such business conflicts,
this must be done in the business logic layer.

How do most of you handle this?  Do you create a validateData()
method in your Action class or is this something that the Model
objects should be able to handle?

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <da...@mojavelinux.com>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Windows: where do you want your data to disappear to today?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org