URL重写技术
数据保存在浏览器显示的页面中
<a href="xxxxx?userName=XX&&passWord=XX">跳到下一链接</a>
点击链接时,浏览器在跳转页面的同时,还会将?后的参数提交给后台
写:out的时候输入源代码
读:String value = request.getParameter("name");
例子代码如下:
protected void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
String userName = req.getParameter("userName");
String passWord = req.getParameter("passWord");
System.out.println(userName+" "+passWord);
res.setContentType("text/html;charset=UTF-8");
PrintWriter out = res.getWriter();
String url = "urlServlet?userName=aa&passWord=bb";
out.println("<a href='"+url+"'>下一个</a>");
}