How to include values from .properties file into web.xml?

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 … Read more

Servlet Mapping using web.xml

It allows servlets to have multiple servlet mappings: <servlet> <servlet-name>Servlet1</servlet-name> <servlet-path>foo.Servlet</servlet-path> </servlet> <servlet-mapping> <servlet-name>Servlet1</servlet-name> <url-pattern>/enroll</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>Servlet1</servlet-name> <url-pattern>/pay</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>Servlet1</servlet-name> <url-pattern>/bill</url-pattern> </servlet-mapping> It allows filters to be mapped on the particular servlet: <filter-mapping> <filter-name>Filter1</filter-name> <servlet-name>Servlet1</servlet-name> </filter-mapping> Your proposal would support neither of them. Note that the web.xml is read and parsed only once … Read more