Hi,
I'm trying using Spring's jsp message tag. I use the url declared in <welcome-file-list> in my web.xml to access the first page of my site, the following exception occurs :
Code:
java.lang.IllegalStateException&#58; No WebApplicationContext found&#58; not in a DispatcherServlet request?
        at org.springframework.web.servlet.support.RequestContextUtils.getWebApplicationContext&#40;RequestContextUtils.java&#58;79&#41;
My WebApplicationContext is loaded using:
Code:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
The exception is thrown by Spring's RequestContextUtils.getWebApplicationContext:
Code:
	public static WebApplicationContext getWebApplicationContext&#40;ServletRequest request&#41;
	    throws IllegalStateException &#123;
		return getWebApplicationContext&#40;request, null&#41;;
	&#125;

	public static WebApplicationContext getWebApplicationContext&#40;ServletRequest request,
	                                                             ServletContext servletContext&#41;
	    throws IllegalStateException &#123;
		WebApplicationContext webApplicationContext = &#40;WebApplicationContext&#41; request.getAttribute&#40;
				DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE&#41;;
		if &#40;webApplicationContext == null&#41; &#123;
			if &#40;servletContext == null&#41; &#123;
				throw new IllegalStateException&#40;"No WebApplicationContext found&#58; not in a DispatcherServlet request?"&#41;;
			&#125;
			webApplicationContext = WebApplicationContextUtils.getWebApplicationContext&#40;servletContext&#41;;
			if &#40;webApplicationContext == null&#41; &#123;
				throw new IllegalStateException&#40;"No WebApplicationContext found&#58; no ContextLoaderListener registered?"&#41;;
			&#125;
		&#125;
		return webApplicationContext;
	&#125;
I think that the behaviour of getWebApplicationContext(ServletRequest request) is strange. Why dosn't it pass the ServletContext from the request instead of passing null? How can I use spring:message tag in pages not related to Spring (for example when I have login.jsp because of container managed security)?