<%@ 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%>">
<title>My JSP 'index.jsp' starting page</title>
</head>
<body>
<jsp:include page="test.jsp"></jsp:include>
<%@include file="test.html" %>
<%@include file="/test.jsp" %>
</body>
</html>
<%@include file="/test.jsp" %> 这个会报错。。去掉
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
就好了。。但我现在不想去掉。。想知道这个路径怎么改
JSP
------解决方案--------------------
<jsp:include page="<%=path%>/test.jsp"></jsp:include>
------解决方案--------------------
test.jsp路径坑可能写错了
------解决方案--------------------
<%@include file=path+"/test.jsp" %>