Announcement Announcement Module
No announcement yet.
Need access to Spring ApplicationContext from EL function Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need access to Spring ApplicationContext from EL function

    I need to develop a JSP EL function for a web application I am working on. This function needs to be able to somehow find the Spring ApplicationContext to call getBean and call some business logic. It appears that the EL functions are implemented as methods in a POJO which does not have access to the PageContext from which I could find the Spring ApplicationContext. I am using org.springframework.web.context.ContextLoaderListe ner to initialize the ApplicationContext.

    My question is: Is there some easy way to locate the ApplicationContext?

  • #2
    You can locate the WebApplicationContext using WebApplicationContextUtils and passing in the ServletContext.



    • #3
      Unfortunately, the class which implements the EL function does not have visibility to the ServletContext or PageContext. So, I need some way of looking up the application context using a singleton or JNDI or threadlocal or something like that.

      Any ideas?