|
From: Nick L. <nl...@es...> - 2004-08-11 04:44:04
Attachments:
applicationContext.xml
content-portlet-portlet.xml
|
Should I be able to use the spring tag library within a Portlet?
I'm using the sandbox portlets code. When I try and use a <spring:bind ...>
tag I get
java.lang.IllegalStateException: No WebApplicationContext found: not in a
DispatcherServlet request?
at
org.springframework.web.servlet.support.RequestContextUtils.getWebApplicatio
nContext(RequestContextUtils.java:81)
at
org.springframework.web.servlet.support.RequestContextUtils.getWebApplicatio
nContext(RequestContextUtils.java:58)
at
org.springframework.web.servlet.support.RequestContext.<init>(RequestContext
.java:91)
at
org.springframework.web.servlet.support.RequestContext.<init>(RequestContext
.java:77)
at
org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(Reque
stContextAwareTag.java:85)
at
org.apache.jsp.WEB_002dINF.jsp.portlet.edit_jsp._jspService(edit_jsp.java:13
5)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
When I start up my webapp I get:
INFO: Loading XML bean definitions from resource
[/WEB-INF/applicationContext.xml] of ServletContext
11/08/2004 14:04:28
org.springframework.context.support.AbstractXmlApplicationContext
refreshBeanFactory
INFO: Bean factory for application context [Root XmlWebApplicationContext]:
org.springframework.beans.factory.support.DefaultListableBeanFactory
defining beans
[messageSource]; Root of BeanFactory hierarchy
11/08/2004 14:04:28
org.springframework.context.support.AbstractApplicationContext refresh
INFO: 1 beans defined in ApplicationContext [Root XmlWebApplicationContext]
11/08/2004 14:04:28
org.springframework.beans.factory.support.AbstractBeanFactory getBean
...
INFO: Published root WebApplicationContext
[org.springframework.web.context.support.XmlWebApplicationContext:
displayName=[Root XmlWebApplicationContext]; startup date=[Wed Aug 11
14:08:53 CST 2004]; root of ApplicationContext hierarchy; config
locations=[/WEB-INF/applicationContext.xml]; ] as ServletContext
attributewith name [interface
org.springframework.web.context.WebApplicationContext.ROOT]
Later, when I hit the portlet for the first time I get
INFO: Loading XML bean definitions from resource
[/WEB-INF/content-portlet-portlet.xml] of PortletContext
11/08/2004 14:09:00
org.springframework.context.support.AbstractXmlApplicationContext
refreshBeanFactory
INFO: Bean factory for application context [XmlPortletApplicationContext for
namespace 'content-portlet-portlet']:
org.springframework.beans.factory.support.DefaultListableBeanFactory
defining beans
[viewResolver,defaultControllerMapping,portletModeNameViewController,editCon
troller,contentViewerController,contentResolver];
parent=<org.springframework.beans.factory.support.DefaultListableBeanFactory
defining beans [messageSource]; Root of BeanFactory hierarchy>11/08/2004
14:09:00 org.springframework.context.support.AbstractApplicationContext
refresh
...
INFO: Published PortletApplicationContext of portlet 'content-portlet' as
PortletContext attribute with name
org.springframework.web.portlet.FrameworkPortlet.CONTEXT.content-portlet]
I'm not an experienced Spring user, so it's probabaly something fairly
obvious I'm missing. I've based my app on the example spring portelt app,
and it all works fine except for this. Any help would be appreciated.
('ve attached my applicationContext.xml and content-portlet-portlet.xml
config files)
Nick
|
|
From: William G. T. Jr. <wg...@ru...> - 2004-08-11 14:25:06
|
Nick Lothian wrote:
> Should I be able to use the spring tag library within a Portlet?
It should, but as you have found out it does not at the moment.
The intent is to have all the WebMVC View technology available in
PortletMVC. However, much of the View technology is dependent on
specifics of the Servlet API. To get around this we wrote a "bridge"
Servlet which PortletMVC delegates to for rendereing. This works ok for
simple JSTL views and allows one to use the Portlet taglib.
The problem now is that <spring:bind ...> is dependendant upon
WebApplicationContext...which is not available in PortletMVC, so we'll
have to figure out a way to also "bridge" the taglib. Essentially if we
are running in PortletMVC we need the tablibs to look for
PortletApplicationContext instead of WebApplicationContext or come up
with an abstraction for both and refactor the tablib.
later.
Bill
>
> I'm using the sandbox portlets code. When I try and use a <spring:bind ...>
> tag I get
>
> java.lang.IllegalStateException: No WebApplicationContext found: not in a
> DispatcherServlet request?
> at
> org.springframework.web.servlet.support.RequestContextUtils.getWebApplicatio
> nContext(RequestContextUtils.java:81)
> at
> org.springframework.web.servlet.support.RequestContextUtils.getWebApplicatio
> nContext(RequestContextUtils.java:58)
> at
> org.springframework.web.servlet.support.RequestContext.<init>(RequestContext
> .java:91)
> at
> org.springframework.web.servlet.support.RequestContext.<init>(RequestContext
> .java:77)
> at
> org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(Reque
> stContextAwareTag.java:85)
> at
> org.apache.jsp.WEB_002dINF.jsp.portlet.edit_jsp._jspService(edit_jsp.java:13
> 5)
> at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
>
>
> When I start up my webapp I get:
>
> INFO: Loading XML bean definitions from resource
> [/WEB-INF/applicationContext.xml] of ServletContext
> 11/08/2004 14:04:28
> org.springframework.context.support.AbstractXmlApplicationContext
> refreshBeanFactory
> INFO: Bean factory for application context [Root XmlWebApplicationContext]:
> org.springframework.beans.factory.support.DefaultListableBeanFactory
> defining beans
> [messageSource]; Root of BeanFactory hierarchy
> 11/08/2004 14:04:28
> org.springframework.context.support.AbstractApplicationContext refresh
> INFO: 1 beans defined in ApplicationContext [Root XmlWebApplicationContext]
> 11/08/2004 14:04:28
> org.springframework.beans.factory.support.AbstractBeanFactory getBean
> ...
> INFO: Published root WebApplicationContext
> [org.springframework.web.context.support.XmlWebApplicationContext:
> displayName=[Root XmlWebApplicationContext]; startup date=[Wed Aug 11
> 14:08:53 CST 2004]; root of ApplicationContext hierarchy; config
> locations=[/WEB-INF/applicationContext.xml]; ] as ServletContext
> attributewith name [interface
> org.springframework.web.context.WebApplicationContext.ROOT]
>
> Later, when I hit the portlet for the first time I get
>
> INFO: Loading XML bean definitions from resource
> [/WEB-INF/content-portlet-portlet.xml] of PortletContext
> 11/08/2004 14:09:00
> org.springframework.context.support.AbstractXmlApplicationContext
> refreshBeanFactory
> INFO: Bean factory for application context [XmlPortletApplicationContext for
> namespace 'content-portlet-portlet']:
> org.springframework.beans.factory.support.DefaultListableBeanFactory
> defining beans
> [viewResolver,defaultControllerMapping,portletModeNameViewController,editCon
> troller,contentViewerController,contentResolver];
> parent=<org.springframework.beans.factory.support.DefaultListableBeanFactory
> defining beans [messageSource]; Root of BeanFactory hierarchy>11/08/2004
> 14:09:00 org.springframework.context.support.AbstractApplicationContext
> refresh
> ...
> INFO: Published PortletApplicationContext of portlet 'content-portlet' as
> PortletContext attribute with name
> org.springframework.web.portlet.FrameworkPortlet.CONTEXT.content-portlet]
>
>
> I'm not an experienced Spring user, so it's probabaly something fairly
> obvious I'm missing. I've based my app on the example spring portelt app,
> and it all works fine except for this. Any help would be appreciated.
>
> ('ve attached my applicationContext.xml and content-portlet-portlet.xml
> config files)
>
> Nick
>
|