您的位置:首页 > 运维架构 > Tomcat

tomcat7和tomcat8 对 资源路径的解析

2016-05-31 10:23 513 查看
在jsp中 我们需要引入静态文件 使用下面的方式

<%@include="/static/path.html"%>


在META-INF 的context.xml 文件中配置别名

<Context aliases="/static=/mfs/ShareFile/static" >
</Context>


这样就能将/static/path.html 映射到 绝对目录中/mfs/ShareFile/static/path.html

但 这种别名写法在tomcat8 里面不行了 需要写成下面的样子

<Context >
<Resources>
<PreResources base="/mfs/ShareFile/static" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/static" />
</Resources>
<Valve className="org.apache.catalina.valves.RemoteAddrValve"  allow=".*" />
</Context>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  include