1

Let's say I have servlet based web application which uses web.xml to define context parameters:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" version="3.0"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee  http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

    <context-param>
        <param-name>logging.path</param-name>
        <param-value>target/logs</param-value>
    </context-param>

</web-app>

Is there any alternative how one can define context params?

The reason I am asking is that you have e.g. @WebFilter annotation to replace <filter-mapping>s in web.xml

1 Answer 1

1

You can define context paramaters programmatically by setting setInitParameter.

later, fetch it by getInitParameter

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.