Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8441593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:36:05+00:00 2026-06-10T08:36:05+00:00

I need to include some values from a file.properties into the WEB-INF/web.xml something like

  • 0

I need to include some values from a file.properties into the WEB-INF/web.xml something like this:

<param-name>uploadDirectory</param-name>
<param-value>myFile.properties['keyForTheValue']</param-value>

I’m currently working with this:

  • JBoss
  • JEE5
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:36:07+00:00Added an answer on June 10, 2026 at 8:36 am

    You can add this class, that add all properties from your file to JVM. And add this class like context-listener to web.xml

    public class InitVariables implements ServletContextListener
    {
    
       @Override
       public void contextDestroyed(final ServletContextEvent event)
       {
       }
    
       @Override
       public void contextInitialized(final ServletContextEvent event)
       {
          final String props = "/file.properties";
          final Properties propsFromFile = new Properties();
          try
          {
             propsFromFile.load(getClass().getResourceAsStream(props));
          }
          catch (final IOException e)
          {
              // can't get resource
          }
          for (String prop : propsFromFile.stringPropertyNames())
          {
             if (System.getProperty(prop) == null)
             {
                 System.setProperty(prop, propsFromFile.getProperty(prop));
             }
          }
       }
    }  
    

    in web.xml

       <listener>       
          <listener-class>
             com.company.InitVariables
          </listener-class>
       </listener>  
    

    now you can get all properties in you project using

    System.getProperty(...)
    

    or in web.xml

    <param-name>param-name</param-name>
    <param-value>${param-name}</param-value>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm packaging an ejb and I need to include some .classes from a dependency
I need some help trying to match a C include file with full path
I have a c++ application. I need to load some config data from file.
I have a ini file which contains some sample values like: [Section1] Value1 =
I have text file(test.data), which include some values and class name, for example 4.5,3.5,U1
I need to include some kind of notifications in a sidebar gadget, preferably systray
I need to include a html file inside a php file, I tried using
I developed a Java desktop application in eclipse IDE.I need to include web view
Previously I asked about how I could call separate values from a text file
I'm looking for some guidance on extracting the rules and property/values from a .css

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.