中国是唯一一个拥有空间站seo推广一个月见效
目录
(1)控制层方法
(2)jsp页面
context作用域表示在整个应用范围都有效。在SpringMVC中对context作用域传值,只能使用ServletContext对象来实现。但是该对象不能直接注入到方法参数中,需要通过HttpSession对象获取。
(1)控制层方法
@RequestMapping("/c2/h6")public String h6(HttpSession session){ServletContext servletContext=session.getServletContext();servletContext.setAttribute("age",999);return "test";}
(2)jsp页面
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head><title>Title</title> </head> <body> <h1>request=${requestScope.name}</h1> <h2>session=${sessionScope.info}</h2> <h3>context=${applicationScope.age}</h3> </body> </html>