Using Service Locator in Struts app without ant eejb components

Hi

We are developing a Struts application witjout any EJB components.

But we may go for EJB in future.

Keeping that in mind we want to introduce a service locator between the action class and the business logic. So it may be easier to acomodate in future.

But how do i do that ? Can anyone help me in this?

Since all the Service locator example which i have seen is implemented using ejb

Please do help me in this

Thanks

Ottran

[482 byte] By [Ottrana] at [2007-10-2 11:51:31]
# 1
Write the locator with a 'normal' signature (from whatever pattern book you are following) and instead of using InitialContext and Context in the method body, simply use the 'new' operator to return an actual instance of the business object.- Saish
Saisha at 2007-7-13 6:25:24 > top of Java-index,Other Topics,Patterns & OO Design...
# 2

Controller (Action class) gets reference to Business Delegate (BD) and calls a particular business method.

The BD gets reference to Service Locator (from JNDI tree) to access a business service. The business sevice can be implemented using EJB, POJO, Web Service, legacy app, etc.

A UML diagram is available at

http://www.softwareleadership.org/docs/J2EEDesignPatterns.html

Click on Business Delegate to view diagram with Service Locator.

Master_Consultanta at 2007-7-13 6:25:24 > top of Java-index,Other Topics,Patterns & OO Design...