webwork中的ActionContext与SevletActionContext

*ActionContext是Webwork与外边容器交户的,与容器无关,但得到得是Map类型的东西,如取得的Session是Map类型的而不是HttpSevletSession

ActionContext ctx = ActionContext.getContext();
Map session = ctx.getSession();
session.put("username",loginInfo.getUsername());

*SevletActionContext是与外面容器耦合的,但可以得到HttpSeveletSession

ServletActionContext.getRequest 得到当前HttpServletRequest 对象的
引用,从而直接与Web 容器交互。

你可能感兴趣的:(ActionContext)