level 1
双鱼弱鸡一枚
楼主
在本机用upupw架设jsp,是正常的,但是传到linux服务器上时,contextPath取值为空了,有没有大佬指点一下是怎么回事,希望详细点。<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style>
.name {
float: left;
width: 133px;
height: 30px;
text-align: center;
line-height: 30px;
font-size: 30px;
background: #eaeaea;
padding: 10px;
}
</style>
</head>
<script src="${pageContext.request.contextPath}/view/js/jquery-1.8.3.min.js"></script>
2021年03月29日 09点03分
1
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style>
.name {
float: left;
width: 133px;
height: 30px;
text-align: center;
line-height: 30px;
font-size: 30px;
background: #eaeaea;
padding: 10px;
}
</style>
</head>
<script src="${pageContext.request.contextPath}/view/js/jquery-1.8.3.min.js"></script>