1

I have too many context-parameters inside web.xml, which I would like to put in a separate config-file.

.....
<context-param>
        <param-name>SYSTEM.UPLOADS.DIR</param-name>
        <param-value>/home/youfaces/uploads/</param-value>
</context-param>
......

In a managed class I want to read these params usually like this:

String XYZ   = servletContext.getInitParameter("param name");

Is it possible to put this params in separate config-file and reading it via .getInitParameter(..? if yes where/how to declare it in web.xml exactly?

Every tip/idea is appreciated.

Thanks

2
  • Maybe stackoverflow.com/questions/9892480/… Commented Apr 4, 2015 at 18:18
  • @JaqenH'ghar, thanks for the link. but what i need is any idea on how to change the configuration not the Code itself. its a big project, coded from many developers, and these params is used every where in the projekt, so changing Java Code is not an Option. Commented Apr 4, 2015 at 22:49

1 Answer 1

3

With Servlet 3.0 and Tomcat 7 you can use web-fragments to have many configuration files. Tomcat will load and build all fragments to one web.xml on runtime.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.