导入js报错
jsp页面进入后台
$.get("请求的java-web-Servlet-内的get()方法";{传递数据名key:”数据值 valu“,......可多个.},function(){});
<script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
<script type="text/javascript">
function doa(){
alert("开始测试");
$.get("Text",{},function(data){
});}
java 部分
selerlt
//跳转 request.getRequestDispatcher("index.jsp").forward(request, response);
//传值 request.setAttribute("user", user);
//获取值: request.getparameter("key");
页面获取!
url为:传输数据类;
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
url url=new url();
url.sqljdbc();
url.selectAll();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script type="text/javascript" src="secrt/jquery-3.1.1.min.js"></script>
<base href="<%=basePath%>">
</head>
<body>
<table>
<c:forEach var="user" items="${user}" varStatus="index">
<tr><td>${user.pwd}${index.index}</td></tr>
<tr><td>${user.name}${index.index}</td></tr>
</c:forEach>
</table>
</body>