Wayne,
Spring Portlet MVC has a corresponding PortletApplicationContextUtils
that you can use in the same manner. Specifically:
this.appContext =
PortletApplicationContextUtils.getRequiredWebApplicationContext(context);
Where 'context' is your PortletContext should work just fine.
See the following for more info on Spring Portlet MVC:
http://opensource.atlassian.com/confluence/spring/display/JSR168/Home
It will be part of Spring 1.3, but you can use the downloads at this
site to solve your problem now.
-- John Lewis
Wayne Glanfield wrote:
I'm currently in the process of porting a JSF(MyFaces1.0.9),
Spring-1.2.5, Hibernate-2.1 application to Jetspeed2m3 portal. I'm
relatively new to all of these frameworks so appologies for any dumb
questions.
I have managed to get as far as configuring and displaying my
application as a portlet, however, I have run into problems when
retrieving the external context (normally the ServletContext) when the
spring service layer is called from JSF page.
My initial application retrieved the external context using something
like this (appologies, for lack of actual code - we are not permitted
to have internet access for various reasons at work)
ServletContext context = (ServletContext)
FacesContext.getCurrentInstance().getExternalContext().getContext();
This returned a servletContext which is then passed to a static spring
utility class to retrieve the spring ApplicationContext. The spring
ApplicationContext is then used to return a reference to the service
layer and DAO.
this.appContext =
WebApplicationContextUtils.getRequiredWebApplicationContext(context);
this.catalogService =
(CatalogService)this.lookupService(CATALOG_SERVICE_BEAN_NAME);
Now when the JSF page is running in a portlet the returned external
context is JetseedPortletContext.
My question is, how do i obtain a reference to the ServletContext or
should I be using the JetspeedPortletContext
Any help greatly appreciated.
_________________________________________________________________
Be the first to hear what's new at MSN - sign up to our free
newsletters! http://www.msn.co.uk/newsletters
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]