1.解耦合
局部變量
session: ActionContext.getContext().getSession();
request: ActionContext.getContext().get("request"); (Map<String,Object>接收)
application: ActionContext.getContext().getApplication();
成員變量
session: 實現SessionAware接口
request: 實現RequestAware接口
application: 實現ApplicationAware接口
2.耦合
局部變量
session: ServletActionContext.getRequest().getSession();
request: ServletActionContext.getRequest();
response: ServletActionContext.getResponse();
application: ServletContext application=ServletActionContext.getServletContext();
成員變量
session: 實現ServletRequestAware接口,通過request.getSession()來取到
request: 實現ServletRequestAware接口
response: 實現ServletResponseAware接口
application: 實現ServletApplicationAware接口