Announcement Announcement Module
No announcement yet.
problem with using <spring:message> ..Anyhelp appreciated Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • problem with using <spring:message> ..Anyhelp appreciated

    I am replacing jstl <fmt> with <spring:message> tag in my web application and i m seeing following exception from framework.

    Stack Trace:
    No WebApplicationContext found: no ContextLoaderListener registered? Start server side stack trace: java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered? at textUtils.getWebApplicationContext(RequestContextU at text.initContext( at questContext.initContext(JspAwareRequestContext.ja va:74) at questContext.( at org.springframework.web.servlet.tags.RequestContex tAwareTag.doStartTag

    I have the following entry in spring config file

    <bean id="messageSource" class=" eBundleMessageSource">
    <property name="basename"><value>MessageResource</value></property>

    Is this configuration enough to use a resource bundle r m i missing anything.

    I also dissected the source code and realised that "webapplication context "will be binded only when the request goes thru "Dispatcher Servlet".When the page is directly accessed it is noway can go thru the Dispatcher Servlet.Is there any other way of binding this "application context" so that it can able to find "messageSource" bean declared in "spring-servlet.xml".

    Thanks in advance.

  • #2
    You can put your messgeSource in a separte applicationContext.xml file and load it using ContextLoaderListener in web.xml.
    This way you can access the messages from plain jsps without going thru Spring DispatchServlet.
    Hope this helps.


    • #3
      Thanks Omar,it just worked fine.