How do you specify the root context in your <web-app> tags in web.xml?

Viewed 92284

I would like to specify the root context of my Java web application in my WAR file. How can I do this using valid web-app XML in a web.xml file?

Oh, yes I would like to do this in an application server agnostic way.

2 Answers

You can use like this in web.xml.

<env-entry>
  <description>web app</description> 
  <env-entry-name>appCxtRoot</env-entry-name>
  <env-entry-type>java.lang.String</env-entry-type>  
  <env-entry-value>webapp-@context-root-value@</env-entry-value>
 </env-entry>

Related