java代码012

code012.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%--
    JSP内置对象

    1.request
    用于处理HTTP请求中的各项参数。
    如,<a href = "delete.jsp?id=1">删除</a>
    可以通过request对象的getParameter()方法获取
    如,request.getParameter("id") 

    在请求转发时,需要把一些数据传递到转发后的页面处理。
    就需要用到request的setAttribute()方法
    如,request.setAttribute(String name,Object obj)
    数据保存后,可以通过request的getAttribute()方法
    获取变量的值
    如,request.getAttribute(String name)

    cookie以key value的形式保存数据到客户机上。
    可以使用getCookies()方法获取集合,通过
    getName获取cookie名称;通过getValue()
    获取对象的值。在向cookie中保存中文时,需要用
    java.net.URLEncoder类的encode()方法将保存的
    cookie信息编码。从cookie读取是,需要使用
    URLDecoder类的decode方法解码。





 --%>
</body>
</html>

评论

h
hw_7864

⭐️ Admin快速开发: https://show.cool-admin.com/

赞 0
h
hw_7864

⭐️ 官方文档: https://cool-js.com

赞 0
h
hw_7864

⭐️ chatgpt在线体验: https://cool-js.com/ai/chat-vip/index.html?r=helloworld

赞 0