Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

M Simpson

Greenhorn
+ Follow
since Dec 09, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by M Simpson

I've struggled with the problem where I wanted to have variables in a web.xml file. I came up with a solution that works but is not so elegant.

Essentially I wrap the real servlet that I want to run in a wrapper servlet that I wrote (SystemPropParametrizedServlet) wherein I can pass System variables via the init-param tag using ${system-var-name} syntax. So basically, when the wrapper servlet gets the init-param's sent to it, it dereferences them to the value set in system properties and passes that to the delegate servlet.

I have included here:

1. web.xml snipped showing it using my servlet with a "delegate" parameter of the class name of the actual servlet and an init-param using the syntax
2. Code for the SystemPropParametrizedServlet delegate
3. A supporting class ParameterSubstituter










And uses:



10 years ago
I agree this does not change the model, but it is confusing. This helped me:
10 years ago