Alex Rivera | Logout

How can I read context parameter/web.xml values in a non-servlet java file?

Asked 2010-11-16T15:21:27.533
19

I've got a regular java file that I use to update and query a mysql database but I need to take configurable options in that file (like host name, password, etc) and put it in the web.xml file (or perhaps another file if that's an option, but ideally in web.xml).

But I don't know how to get access to web.xml values from a regular non-servlet java file.

Or would I need to read the xml (like any other xml file... or is there a shortcut route to this...)

Edit
Report

1 Answer

0

Create a static class that would be initialized from one of the servlets init.

answered 2010-11-16T15:36:05.320

Your Answer