Request.getAttribute() 跟 Request.getSession().getAttribute() 之g有什N不同

Request.getAttribute() 跟 Request.getSession().getAttribute() 之g有什N不同

存在request中的对象,从request.getAttribute("xx")中取
存在session中的对象,从session.getAttribute("xx")中取

其实到现在还搞不清楚,到底request的作用范围是多大?怎么样判断,他的作用范围已经过期了呢?

带session的是为了安全吧

Web层scope分几种:request httpsession 和application,
request是用户从浏览器发出请求开始,到用户浏览器接受到结果Jsp页面结束。

在MVC模式中,request存在下面环节:
表单Jsp ---> Servlet ---> 结果Jsp
这三个环节通过request的attribute可以共享数据或对象。

也就是说在结果jsp页面里还是可以用request的是吧?恩,好的,谢谢了。对request的作用范围终于有了一个具体点的理解。

String fenci=request.getSession().getAttribute("fenci").toString()这段代码是什么意思啊?谢谢

从session取出相应的值,并转化成string类型的,然后赋给fenci变量