Are session and sessionScope the same in JSP EL?

后端 未结 5 2060
[愿得一人]
[愿得一人] 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:34

    The ActionContext is a Struts2 thing, and it's created in every request that is handled by the framework. When it's created the framework populates it along with the servlet stuff with it's own implementations of request, session, and applicaton. And where you using it in the application these objects are referenced. To access the servlet stuff use the ServletActionContext that helps to retrieve the appropriate resources. Struts2 also wraps the ServletRequest to provide access to the action properties and valueStack from the EL expressions. sessionScope, requestScope, and applicationScope used with EL expressions to evaluate to the servlet stuff attributes. That are the differences.

提交回复
热议问题