Are session and sessionScope the same in JSP EL?

后端 未结 5 2062
[愿得一人]
[愿得一人] 2020-12-02 20:58
public class LoginAction extends ActionSupport {
    private String username;
    private String password;

    @Override
    public String execute() throws Exceptio         


        
5条回答
  •  甜味超标
    2020-12-02 21:47

    1. session, request, application are the actually HttpSession,HttpServletRequest and ServletContext objects while sessionScope, requestScope and applicationScope provide access to all the session, request and application scoped attributes.

    You can say that applicationScope > sessionScope > requestScope.

    • applicationScope attributes will be accessible to all the sessions, all the requests across the web applications. These attributes stay alive as long as application is alive
    • sessionScope attributes will be accessible to all the requests across the current HttpSession. These attributes stay alive as long as session is alive
    • requestScope attributes will be accessible from the current request only. Once the response is completed, they are gone.

提交回复
热议问题