[AppleScript] 纯文本查看 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="../js/jquery-3.3.1.min.js"></script>
</head>
<body>
<form action="/day36/testServlet?age=12&gender=男" method="post">
<input name="username" type="text"/><br/>
<input name="password" type="text"/><br/>
<input type="submit" value="submit"/>
</form>
<script>
var inputs = $("input");
$(inputs[0]).val("aaa");
</script>
</body>
</html>
[AppleScript] 纯文本查看 复制代码
package com.lincain.servlet;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
@WebServlet("/testServlet")
public class TestServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
Map<String, String[]> map = request.getParameterMap();
Iterator<Map.Entry<String, String[]>> iterator = map.entrySet().iterator();
while (iterator.hasNext()){
Map.Entry<String, String[]> entrySet = iterator.next();
System.out.println(entrySet.getKey() + " : " + entrySet.getValue()[0]);
}
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
this.doPost(request, response);
}
}