读书人

Struts2 Action标签跟Tomcat启动速度慢

发布时间: 2012-10-18 13:46:55 作者: rapoo

Struts2 Action标签和Tomcat启动速度慢(二)
这几天在混日记,很痛苦,前几天就把上个问题解决了,现在写出来。
jsp的内置对象还记得吗?一共有九个。现在要用的是:request。
在Action中这样写:

@SuppressWarnings("unchecked")public String FindProductsType() throws Exception{String modelId="3";String nametype;if(this.nametype==null){nametype=ActionContext.getContext().getSession().get("name").toString();}else{nametype=ActionContext.getContext().getSession().put("name", this.nametype).toString();}Map request=(Map)ActionContext.getContext().get("request");request.put("list", service2.findName(modelId));pageBean=service.queryForPageToUser(3, page, nametype);request.put("pageBeanList", pageBean);return "findproductstype";}

jsp页面:
<s:property value="#request.pageBeanList"/>

反正意思就是这样,在Action中没有把值放到内置对象里面,然后再jsp页面时肯定取不出来的,在struts2中它是把这些东西都封装好了。

读书人网 >软件架构设计

热点推荐