|
这几天在混日记,很痛苦,前几天就把上个问题解决了,现在写出来。
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中它是把这些东西都封装好了。 |
|
|