Announcement Announcement Module
Collapse
No announcement yet.
webAppRootKey returned as null in System.getProperty() Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • webAppRootKey returned as null in System.getProperty()

    I have a webapp using Spring and JSF.

    I have the following in web.xml:
    HTML Code:
      <listener>
        <listener-class>
          org.springframework.web.util.WebAppRootListener
        </listener-class>
      </listener>
    
      <context-param>
        <param-name>webAppRootKey</param-name>
        <param-value>thisWebApp.root</param-value>
      </context-param>
    In my backing bean, I call:

    Code:
    System.getProperty("thisWebApp.root");
    ... but the result is null. Any ideas as to why it is null... it used to work before, and I haven't modified any configuration files since. So I'm stumped. Any advice would be greatly appreciated!

    P.S., I posted this in reply to thread 211465 (I would post a link but haven't made enough posts to include links...) I feel it deserves its own thread

  • #2
    any ideas? I'm having same problem too.. Need ur helps..

    Comment


    • #3
      As far as i know context-param(s) is/are stored in the ServletContext and are used to initialize the servlet. They cannot/shouldnt be used as System poperties. Use plain property files and http://static.springsource.org/sprin...onfigurer.html to expose them to your spring beans.

      EDIT: I saw your previous post and looks like there is a way someone was able to retrieve servlet init parameters using System.getProperty, but my advice still stands. Depending on what container you are using that approach might or might not work. Its definitely not according to the J2ee Spec. So i think you are better off using regular properties bundles for distributing token values.
      Last edited by maheshguruswamy; Nov 1st, 2010, 03:25 PM.

      Comment

      Working...
      X