第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

jsp如何實(shí)現(xiàn)這個(gè)案例啊

有人用jsp做這個(gè)案例成功了嗎?有的話可以分享給我參考看看嗎

正在回答

1 回答

我也是剛剛看到這里,我只做了一個(gè)小的模仿,只做了第一小題的簡(jiǎn)化版,關(guān)鍵點(diǎn)在于前后端的數(shù)據(jù)是如何傳遞的,理解了第一題我覺得第二題肯定也不會(huì)太難做,希望能夠幫到你。

????????????????????????????這是后端的servlet代碼,我寫的很簡(jiǎn)單,希望不要嫌棄。

????????????????????????https://img1.sycdn.imooc.com//5b26201f0001e49f07330364.jpg

https://img1.sycdn.imooc.com//5b261ebc0001bb2008080642.jpg

前端代碼:

<%@?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>
<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">
-->
<script?type="text/javascript">
window.onload=function(){
document.getElementById("username").onblur=function(){
var?xmlhttp?=?null;
if(window.XMLHttpRequest)
xmlhttp?=?new?XMLHttpRequest();
else
xmlhttp?=?new?ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET",?"http://localhost:8080/myfirstwebapp/cat?username="+document.getElementById("username").value.toString());
xmlhttp.send();
xmlhttp.onreadystatechange?=?function(){
if(xmlhttp.readyState==4&&xmlhttp.status==200)
document.getElementById("queryUserName").innerHTML?=?xmlhttp.responseText;
};
}
document.getElementById("username").onfocus=function(){
document.getElementById("queryUserName").innerHTML?=?"";
}
}
</script>
??</head>
??
??<body>
????<h2?style="color:red;">測(cè)試ajax程序</h2>
????<form?action="">
????用戶名:<input?id="username"?type="text"?name="username">&nbsp;&nbsp;
????<span?id="queryUserName"?style="color:red;"></span>
????</form>
??</body>
</html>
1 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
Ajax全接觸
  • 參與學(xué)習(xí)       224774    人
  • 解答問題       708    個(gè)

本課程通過一個(gè)案例,講解Ajax的相關(guān)概念原理實(shí)現(xiàn)方式和應(yīng)用

進(jìn)入課程

jsp如何實(shí)現(xiàn)這個(gè)案例啊

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

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

幫助反饋 APP下載

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

公眾號(hào)

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