jsp base路径

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
  </head>
 
  <body>
    
  </body>
</html>

 

posted @ 2016-10-20 16:05  Mr.Ming2  阅读(128)  评论(0编辑  收藏  举报