摘要: Struts2 相比 Struts1 而言,不用直接访问 Servlet API, 使得 Action 可以脱离 Web 容器进行测试。那么 Struts2 访问 Servlet API 有三种方式:1.使用 ActionContext 在程序中使用 ActionContext ac = ActionContext.getContext(); 获取到ActionContext的一个实例,然后使用ac.put("key", "value");将信息返回给Web前端。但使用该方法需要在Action类中实现request参数的setter()和getter() 阅读全文
posted @ 2013-03-11 09:46 lihui_yy 阅读(3168) 评论(0) 推荐(0) 编辑