首页 技术 正文
技术 2022年11月21日
0 收藏 951 点赞 3,596 浏览 861 个字

request:

1、request.getParameter(“key”)接受的是来自客户登陆端的数据,接受的是post或get方式传送的value。

2、请求的默认字符集是ISO-8859-1,不支持中文,需要new String (request.getParameter(key).getbyte(“ISO-8859-1″),”UTF-8”)进行转码。

3、可以给请求对象添加数据但是必须通过forward进行转发。

4、request.setAttribute(key,object)–发送对象,request.getAttribute(key,object)–接受对象。

5、接收cookie  Cookie[] ck = request.getCookies();获取值–遍历for(Cookie cks:ck){out.print(URLDecoder.decode(“编码后的字符串”))}。

response:

1、发送cookie–添加cookie对象:Cookie ck=new Cookie(“key”,”value”);addCookie(Cookie对象)

2、跳转页面–sendRedirect(“跳转地址”)–直接跳转。

3、setHeader(“refresh”,”秒数;URL=跳转地址”)–定时跳转页面。

4、setHeader(“refresh”,”秒数”)–定时刷新页面。

5、没有设置属性值的方法。没有setAttribute的方法。

6、setheader(“cache-control”,”no-cache”)–禁止浏览器缓存

session:

1、setAttribute(“key”,object)–设置属性值。getAttribute(“key”)–获取属性值–返回Object类型需要将获取到的值用toString()方法。

2、session.invalidate()–销毁session–一般退出登录时用。

3、setMaxInactiveInterval(秒数)–设置超时秒数。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,960
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,485
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,330
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,113
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,745
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,780