且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将magnoliaPublic上下文内容嵌入到其他Web应用程序上下文中

更新时间:2023-01-06 13:58:34

Tomcat默认情况下不允许您访问其他Servlet上下文.我想这就是您使用context属性的c:import失败的原因.

Tomcat does not allow you to access another Servlet Context by default. I guess that is the reason why your c:import using the context attribute fails.

Tomcat具有crossContext属性,该属性对此进行配置:

Tomcat has the crossContext attribute which configures this:

如果要在此应用程序内调用ServletContext.getContext()以成功返回在此虚拟主机上运行的其他Web应用程序的请求分派器,请设置为true.在注重安全的环境中设置为false(默认值),以使getContext()始终返回null.

Set to true if you want calls within this application to ServletContext.getContext() to successfully return a request dispatcher for other web applications running on this virtual host. Set to false (the default) in security conscious environments, to make getContext() always return null.

来源: http://tomcat.apache.org/tomcat- 7.0-doc/config/context.html

启用crossContext可能会解决您的问题.

Enabling crossContext might solves your problem.