request.setAttribute("num",value);
有效范围是一个请求范围,不发送请求的界面无法获取到value的值,jsp界面获取使用EL表达式${num};
request.getSession().setAttribute("num",value);
有效范围是一个session周期,在session过期之前或者用户关闭页面之前是有效的,jsp界面获取使用EL表达式${num};
---------------------
作者:ゝPan。
来源:CSDN
原文:https://blog.csdn.net/qq_36385601/article/details/82788003
版权声明:本文为博主原创文章,转载请附上博文链接!

HttpServletRequest中的request.setAttribute()和request.getSession().setAttribute()的更多相关文章

  1. request.getSession().setAttribute("",..)和request.setAttribute("",...)的差别

    request.getSession.setAttribute()是获得当前会话的session,然后再setAttribute到session里面去,有效范围是session而不是request. ...

  2. Cookie中的三个容器request,session,application的设置和获取

    public class SaveServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpSer ...

  3. struts 在Action中访问web元素(request,session等)

    出发jsp: <?xml version="1.0" encoding="GB18030" ?> <%@ page language=&quo ...

  4. 在Struts2 Action中快速简便的访问Request、Session等变量

    前言——正常情况下如何在Action中获取到这些变量 全部方法(共四种)可以参考:http://blog.csdn.net/itmyhome1990/article/details/7019476 这 ...

  5. request.setAttribute和request.getAttribute还有session.setAttribute和session.getAttribute还有request.getParameter和request.getAttribute区别和联系

    1.session.setAttribute()和session.getAttribute()配对使用,作用域是整个会话期间,在所有的页面都使用这些数据的时候使用. 2.request.setAttr ...

  6. request.getParameter()与request.setAttribute()的区别 (转载)

    request.getParameter()与request.setAttribute()的区别 request.getParameter(),request.setAttribute()区别如下: ...

  7. request.setAttribute()、session.setAttribute()和request.getParameter()的联系与区别(记录)

    1.session.setAttribute()和session.getAttribute()配对使用,作用域是整个会话期间,在所有的页面都使用这些数据的时候使用. 2.request.setAttr ...

  8. 此时servlet中的request和我们在页面jsp中的request 是同一个request.

    在tomcat容器启动的时候,jsp页面的内置对象request,response,同样是依赖于tomcat容器中的servlet-api.jar包,这个jar包和我们在web项目中的jar包是一样的 ...

  9. request.setAttribute()、session.setAttribute()和request.getParameter()的联系与区别

    1.session.setAttribute()和session.getAttribute()配对使用,作用域是整个会话期间,在所有的页面都使用这些数据的时候使用. 2.request.setAttr ...

随机推荐

  1. linux Apache 日志轮询

    安装日志轮询工具 cronolog [root@Nagios-Server tools]# wgethttp://cronolog.org/download/cronolog-1.6.2.tar.gz ...

  2. PyMySQL和MySQLdb的区别

      网上很多关于Scrapy存入MySQL的教程,都会发现又这么一个包的引入: import MySQLdb import MySQLdb.cursors 聪明的你或许已经算到,需要安装MySQLdb ...

  3. ERROR: Unable to clean up existing run directory

    Project Navigator - Launching PlanAhead gives: ERROR: Unable to clean up existing run directory   De ...

  4. fpga新建nios

    [FPGA]基于Qsys的第一个Nios II系统设计 (2013-12-12 21:50:08) 转载▼ 标签: fpga niosii qsys helloword quartusii 分类: 嵌 ...

  5. GIT 开发流程

    1.git clone 使用 git clone 将一个项目下载到本地 2.git checkout -b branchName 新建一个branchName的本地分支 3.git add file/ ...

  6. AtCoder Beginner Contest 089 D - Practical Skill Test

    Problem Statement We have a grid with H rows and W columns. The square at the i-th row and the j-th ...

  7. u-boot-2016.09 make编译过程分析(二)

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/guyongqiangx/article/ ...

  8. 图解NuGet服务器搭建和使用过程

    听语音 浏览:0 | 更新:2017-10-31 09:13 | 标签:服务器 1 2 3 4 5 6 7 分步阅读 本篇经验将和大家介绍内网搭建NuGet服务器的步骤,希望对大家的工作和学习有所帮助 ...

  9. oracle date函数

    常用的时间格式 在oracle中有 yyyy-mm-dd hh24:mi:ss  而在Java中有些区别 为yyyy-MM-dd HH:mm:ss 这点还是经常容易模糊的.相信很多人都有过统计某些数据 ...

  10. 【JavaScript】 模拟JQuery的连续调用函数

    连续调用,了解调用主体 var zhangsan = { smoke: function () { console.log("Smoking..."); return this; ...