You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jerry Jalenak <Je...@LABONE.com> on 2003/06/03 15:25:43 UTC

[OT - Design] Business Logic and JavaBeans

I'm considering placing specific business logic methods in the JavaBean that
has the business elements used by these methods.  In other words, something
like this - 

	public class User
	{
		private String userID;
		.....

		public User() {}

		... getters / setters for attributes ...

		public Object validateUserID()
		{
			... business logic ...
		}
	}

The validateUserID method would call appropriate DAO's, etc. as needed.  My
struts action would instantiate the bean, then call the validateUserID
method.  Is this an OK approach to encapsulating related business 'stuff'
together?  Any obvious problems that I am completely overlooking?

Thanks!

Jerry Jalenak
Team Lead, Web Publishing
LabOne, Inc.
10101 Renner Blvd.
Lenexa, KS  66219
(913) 577-1496

jerry.jalenak@labone.com


This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: securityincidentreporting@labone.com



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


Re: [OT - Design] Business Logic and JavaBeans

Posted by Ted Husted <hu...@apache.org>.
This is an OK approach to encapsulating related business 'stuff'.

The acid test is whether your business classes import anything from the 
Struts or HTTP packages. So long as this is not the case, then your 
business classes are keeping the presentation tier at arm's length.

Likewise, if your Struts classes aren't importing anything from SQL and 
the like, it's a good indication that you're keeping the system logic 
out of the controller/presentation layer.

-Ted.

Jerry Jalenak wrote:
> I'm considering placing specific business logic methods in the JavaBean that
> has the business elements used by these methods.  In other words, something
> like this - 
> 
> 	public class User
> 	{
> 		private String userID;
> 		.....
> 
> 		public User() {}
> 
> 		... getters / setters for attributes ...
> 
> 		public Object validateUserID()
> 		{
> 			... business logic ...
> 		}
> 	}
> 
> The validateUserID method would call appropriate DAO's, etc. as needed.  My
> struts action would instantiate the bean, then call the validateUserID
> method.  Is this an OK approach to encapsulating related business 'stuff'
> together?  Any obvious problems that I am completely overlooking?
> 
> Thanks!
> 
> Jerry Jalenak
> Team Lead, Web Publishing
> LabOne, Inc.
> 10101 Renner Blvd.
> Lenexa, KS  66219
> (913) 577-1496
> 
> jerry.jalenak@labone.com
> 
> 
> This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: securityincidentreporting@labone.com
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 


-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>



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