首页 > 其他分享 >Servlet10 - 四种保存作用域

Servlet10 - 四种保存作用域

时间:2023-01-17 17:34:44浏览次数:40  
标签:uname 作用域 request lili setAttribute application Servlet10 四种

Servlet 中的四种保存作用域

可以认为有四个:page、request、session、application

  • page 页面级别,几乎不再使用

  • request 一次请求响应范围

    • request.setAttribute("uname","lili");
      
  • session 一次会话范围

    • request.getSession().setAttribute("uname","lili");
      
  • application 整个应用程序范围

    • ServletContext application = request.getServletContext();
      application.setAttribute("uname","lili");
      

标签:uname,作用域,request,lili,setAttribute,application,Servlet10,四种
From: https://www.cnblogs.com/Ashen-/p/17058376.html

相关文章

  • 学习笔记——Spring管理第三方bean;Spring中Bean的作用域;Spring中Bean的生命周期;Spring
    2023-01-17一、Spring管理druid步骤 (1)导入jar包<!--https://mvnrepository.com/artifact/com.alibaba/druid--><dependency><groupId>com.a......
  • Servlet6 - Session保存作用域
    session的保存作用域向当前session保存作用域保存一个键值对数据HttpSessionsession=request.getSession();session.setAttribute(key,value);sessionID相同......
  • C#变量的作用域
    usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;namespacelearn_val_location{interna......
  • JSP内置对象及作用域
       ......
  • JavaScript学习笔记—全局和局部作用域
    作用域(scope)指的是一个变量的可见区域全局作用域在网页运行时创建,在网页关闭时消耗所有直接编写到script标签中的代码都位于全局作用域中变量是全局变量,可以在任意......
  • 什么是作用域和作用域链?
    一、作用域作用域,即变量(变量作用域又称上下文)和函数生效(能被访问)的区域或集合换句话说,作用域决定了代码区块中变量和其他资源的可见性举个例子functionmyFunction()......
  • JavaScript 中搜索数组元素的四种方法
    在实际开发当中,我们经常会遇到类似诸如下面的需求:获取满足特定条件的数组中的所有项目要检查是否满足条件?检查数组中是否有特定值?在数组中找到指定值的索引?在本文中,我们将讨......
  • 【Spring注解】3.@Scope作用域&4.@Lazy懒加载
    微信公众号:​​程序yuan​​关注可了解更多的资源。问题或建议,请公众号留言;3.@Scope作用域1.@Scope的源码@Target({ElementType.TYPE,ElementType.METHOD})@Retention(Re......
  • C#作用域、访问修饰符和命名空间
    类、记录和结构的访问直接在命名空间中声明的类、记录和结构(换句话说,不嵌套在其他类或结构中)可以是pub1ic,也可以是internal。如果没有指定访问修饰符,则默认为internal。......
  • 复习第6点-6.SpringMVC作用域传值
    作用域范围对象名称作用范围application整个作用范围session在当前会话中有效request在当前请求中有效page在当前页面有效request/session/app......