开发者

purpose of webAppRootKey?

开发者 https://www.devze.com 2022-12-13 08:37 出处:网络
Can somebody explain this entry in web.xml ? When it has to be used and why ? <context-param> <param-name>webAppRootKey</param-name>

Can somebody explain this entry in web.xml ? When it has to be used and why ?

<context-param>
    <param-name>webAppRootKey</param-name>
    <param-value>webapp.root</param-value>
</context-param>

Is this something related to Spri开发者_如何转开发ng or general one?


It is both general and Spring Specific. context-param allows you to specify context parameters (that is general) but what you specify is specific to your application, and your application will look for the parameter and use it.

In this case it is the key of the system property that should specify the root directory of this web app. Applied by WebAppRootListener or Log4jConfigListener.


I had the same question, and found this page and later WebApproot in Spring. It is best explained there in mblinn's answer.


this param is very important, in my tomcat I have two app, in order to achieve localhost/ navigates to app1 and 127.0.0.1/ navigates to app2, FYI both of their context path is / , what I do is I add another Host element to tomcat's server.xml with defaultHost name is 127.0.0.1 and appBase is parent dir of ROOT.war (app2)

hope this is useful

0

精彩评论

暂无评论...
验证码 换一张
取 消