Actually my code goes like this.......
public class UserBean extends BaseBean {
public String loginAction() {
try {
User user = this.serviceLocator.getUserService().login
(this.username.trim(), this.password.trim());
catch (Exception e) {
}
}
}
-------------------------------------------------
public class BaseBean {
//the logger for this class
protected final Log logger = LogFactory.getLog(this.getClass());
//the service locator of the business services
protected ServiceLocator serviceLocator;
public BaseBean() {
}
public ServiceLocator getServiceLocator() {
return this.serviceLocator;
}
public void setServiceLocator(ServiceLocator
newServiceLocator) {
this.logger.debug("service locator is set");
this.serviceLocator = newServiceLocator;
this.init();
}
--------------------------------------------------------------------
public interface ServiceLocator {
/**
* Get the <code>UserService</code>.
*
* @return the user service
*/
public UserService getUserService();
}
Thanks..