亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

正在回答

5 回答

怎么解決呢,也遇到這個問題了

0 回復 有任何疑惑可以回復我~

我也是出現同樣的問題,看到有一個警告提示是說:The method getRealPath(String) from the type ServletRequest is deprecated

0 回復 有任何疑惑可以回復我~

應該是:tomcat安裝路徑\webapps\項目名字\request.jsp 才對。

0 回復 有任何疑惑可以回復我~
#1

gary_gary

我也出現同樣的問題,不知道是什么原因,同樣是NULL
2015-04-24 回復 有任何疑惑可以回復我~
<%@?page?language="java"?import="java.util.*"?contentType="text/html;?charset=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>request內置對象</title>
	<meta?http-equiv="pragma"?content="no-cache">
	<meta?http-equiv="cache-control"?content="no-cache">
	<meta?http-equiv="expires"?content="0">????
	<meta?http-equiv="keywords"?content="keyword1,keyword2,keyword3">
	<meta?http-equiv="description"?content="This?is?my?page">
	<!--
	<link?rel="stylesheet"?type="text/css"?href="styles.css">
	-->
??</head>
??
??<body>
???<h1>request內置對像</h1>
??<%
????request.setCharacterEncoding("utf-8");?//解決中文亂碼問題,無法解決URl傳參的亂碼問題
????request.setAttribute("password",?"123456");
???%>
??用戶名:<%=request.getParameter("username")?%><br>
??愛好:<%
??if(request.getParameterValues("favorite")!=null)
??{
?????String[]?favorites?=?request.getParameterValues("favorite");
?????for(int?i=0;i<favorites.length;i++)
?????{
???????out.println(favorites[i]+"&nbsp;&nbsp;");
?????}
???}
???%><br>
??????密碼:<%=request.getAttribute("password")%><br>
??????請求的MIME類型:<%=request.getContentType()?%><br>
??????獲得協議類型及版本號:<%=request.getProtocol()?%><br>
??????獲得服務器主機名字:<%=request.getServerName()?%><br>
??????獲得服務器的端口號:<%=request.getServerPort()?%><br>???
??????請求文件的長度:<%=request.getContentLength()?%><br>
??????請求客戶端的IP地址:<%=request.getRemoteAddr()?%><br>
??????請求的真實物理路徑:<%=request.getRealPath("request.jsp")?%><br>
?????請求的上下文路徑:<%=request.getContextPath()?%>?<br>
??</body>
</html>


0 回復 有任何疑惑可以回復我~

親,能不能把你jsp里面的代碼粘貼出來,好幫你分析原因。

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號