weilu2

将该内容放入一个空白的JSP文件中,保存为basepath.jsp,然后在需要引用的JSP文件中使用include标签引用。

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
request.setAttribute("basePath", basePath);
%>

 

分类:

技术点:

相关文章: