摘要:
web.xml index.jsp struts2 org.apache.struts2.dispatcher.FilterDispatcher struts2 /* //struts.xml success.jsp ... 阅读全文
摘要:
***************1.[一般推荐使用](只能获得request,而response则得不到)**********************ActionContext.getContext().put("liuwei", "andy"); //request.setAttribute("liuwei", "andy"); Map map=ActionContext.getConte... 阅读全文
摘要:
在Struts2里,如果需要在Action中使用session,可以通过下面两种方式得到 1.通过ActionContext class中的方法getSession得到 2.Action实现org.apache.struts2.interceptor.SessionAware接口的方式来对session进行操作 下面先看一个采用第一种方式,在action中得到session的例子 ... 阅读全文
摘要:
在struts1中,获得到系统的request或者session对象非常方便,都是按照形参传递的,但是在struts2中,request和session都被隐藏了struts提供两种方式访问session和request,其中比较常用的是利用SPRING里面所说的IOC即控制反转IOC方式:action类实现ServletRequestAware接口,并新建一个HttpServletRequest... 阅读全文