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]

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
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.