I created index.jsp
page and binded path /index
to it in web.xml
.
It's also displayed when accessing the root of application as welcome page. It has three init parameters.
The problem is I can access then from JSP code by config.getInitParameter()
if the path is full [host:port]/[appName]/index
, the parameters are accessed normally.
If I try to navigate to application root [host:port]/[appName]/
welcome page is displayed but init parameters can't be accessed. config.getInitParameter()
method returns null.
How to configure welcome page properly in web.xml if I want to get servlet init parameters?
Do you have index.jsp defined as a "welcome-file" in web.xml? It sounds like the container is doing a redirect. Defining index.jsp as a welcome-file should fix that.
Hope that helps.