Announcement Announcement Module
No announcement yet.
Can one use .properties variables in web.xml file? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can one use .properties variables in web.xml file?

    I have a web application with a PropertyPlaceholderConfigurer that fetches properties from a

    In web.xml I have:


    I was trying to set up this web.xml element:
    where is in my However, this doesn't resolve. My question is: is it possible to use placeholder properties in web.xml ? If so, how?

    Thank you for the help!

  • #2
    this post will help you resolve your problem


    • #3
      Originally posted by vishnu.joshi View Post
      this post will help you resolve your problem
      I don't think it's the same. That link talks about "defining which properties file to use in web.xml", not about setting web.xml elements to values defined in a properties file.


      • #4
        It isn't possible, spring will only use the properties to replace values in applicationcontexts not in other files.


        • #5
          Yes you are right its not the same. If you want to access the values of a property file in web.xml then i think it won't be possible. As the app server or web server reads the web.xml and they provide no such support.

          If you want to set the session timeout using property file then a work around could be using a HttpSessionListener. In the sessionCreated() method, you can set the session timeout using your property file value.


          • #6
            I suggest using a listener to set the session timeout (or other j2ee properties) programmatically reading the values from a properties file at the start of the application.


            • #7
              Hi vishnu.joshi. Thank for sharing link. It helps me, too.