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

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Rami.Q
  • 2,486
  • 2
  • 19
  • 30
  • Maybe http://stackoverflow.com/questions/9892480/loading-properties-file-in-init-of-servlet-without-using-context-param-tag-in – Jaqen H'ghar Apr 04 '15 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. – Rami.Q Apr 04 '15 at 22:49

1 Answers1

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.

Matthias
  • 1,378
  • 10
  • 23