第一种:ActionContext类来获取
新建一个JSP,然后通过Action来调用表单获取项。其中 getContext是一个static静态类的方法,所以不要用新建来创建,
直接用ActionContext context=ActionContext.getContext();
Map<string,object>来遍历。
降低耦合度!!!
第二种:ServletActionContext类来获取
static方法: HttpServletRequest getRequest() HttpServletResponse getResponse()
ServletContext getServletContext() PageContext getPageContext()
第三种:接口的方法
嗯,不会。
属性封装:太麻烦了。。
模型驱动封装:真好。。接口ModelDriven<T>就OK;;要求,实体类属性名称和表单中提交的name名称一样就OK。。不能和属性封装同时使用,同时使用会仅使用模型封装。
表达式封装:在Action中光声明就OK,然后get和set方法,然后修改表单。。