Servlet转发会让转发后页面相对路径以Servlet根路径为基础
所以可以在jsp页面头部加入
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" +
request.getServerPort()
+ path + "/(如果还有文件名目录可以加文件夹名字)";
%>
<head>
<base href="basePath">
</head>
最后
以上就是淡淡火最近收集整理的关于servlet转发导致的页面路径失效问题解决的全部内容,更多相关servlet转发导致内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复