最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

為什么添加了判斷語(yǔ)句后愛(ài)好什么都沒(méi)有顯示

<%@ 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>My JSP 'request.jsp' starting page</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內(nèi)置對(duì)象</h1>

<%

request.setCharacterEncoding("UTF-8");

request.setAttribute("password", "123456");

%>

用戶名:<%=request.getParameter("username") %><br>

愛(ài)好:<% ?

if(request.getParameterValues("favortie")!=null){

String[] favorites = request.getParameterValues("favorite");

for(int i=0;i<favorites.length;i++)

{

out.println(favorites[i]+"&nbsp;&nbsp;");

}

}

%>

密碼:<%=request.getAttribute("password") %><br>

請(qǐng)求體的MIME類型:<%=request.getContentType() %><br>

協(xié)議類型及版本號(hào):<%=request.getProtocol() %><br>

服務(wù)器主機(jī)名:<%=request.getLocalName() %><br>

服務(wù)器端口號(hào):<%=request.getLocalPort() %><br>

請(qǐng)求文件的長(zhǎng)度:<%=request.getContentLength() %><br>

請(qǐng)求客戶端的IP地址:<%=request.getLocalAddr() %><br>

請(qǐng)求的真實(shí)路徑:<%=request.getRealPath("request.jsp") %><br>

請(qǐng)求上下文的路徑:<%=request.getContextPath() %><br>

? </body>

</html>






<%@ 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>My JSP 'reg.jsp' starting page</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>用戶注冊(cè)</h1>

? ? <hr>

? ? <form action="response.jsp" name="regForm" method="post">

? ? <table>

? ? <tr>

? ? <td>用戶名:</td>

? ? <td><input type="text" name="username"/></td>

? ? </tr>

? ? <tr>

? ? <td>愛(ài)好:</td>

? ? <td>

? ? <input type="checkbox" name="favorite" value="read"/>讀書(shū)

? ? <input type="checkbox" name="favorite" value="music"/>音樂(lè)

? ? <input type="checkbox" name="favorite" value="movie"/>電影

? ? <input type="checkbox" name="favorite" value="internet"/>上網(wǎng)

? ? </td>

? ? </tr>

? ? <tr>?

? ? <td colspan="2"><input type="submit" value="提交"/></td>

? ? </tr>

? ?

? ? </table>

? ? </form>

? ? <br>

? ? <br>

? ? <a href="request.jsp?username= 李四 " >測(cè)試URL傳參數(shù)</a>

??

? </body>

</html>

求大神看看為什么添加了判斷語(yǔ)句后愛(ài)好沒(méi)有顯示????

正在回答

1 回答

if(request.getParameterValues("favortie")!=null) 你指的是這句么?

如果你沒(méi)勾選愛(ài)好肯定是不會(huì)顯示了,或者點(diǎn)擊超鏈接也沒(méi)有,因?yàn)槌溄記](méi)傳遞愛(ài)好,添加這句只是為了防止報(bào)空指針異常?out.println(favorites[i]+"&nbsp &nbsp");

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

為什么添加了判斷語(yǔ)句后愛(ài)好什么都沒(méi)有顯示

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)