求助,jsf关于commandlink和datatable的两个问题,请高人指点。 log 一下,看看ExternalContext到底有没有CostumerList还有这个方法执行了几次 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你处理的方式不对,以下仅提供思路:如你你两个页面和一个managedbean,分别为a.jsf,b.jsf和mbean.1.a.jsf是你查询条件的页面并有一个commandLink,用于提交,代码大致如下:<h:commandLink id="link" value="确定" action="#{mbean.query}">如果要提交到新页面请使用以下方法:<h:commandLink id="link" value="确定" action="#{mbean.query}" target="_blank">2.建立managedbean mbean,范围为request即可。在Bean里至少有public String query()方法,返回值为b.jsf的映射字符串,并且有一个属性List costumerList及它的get方法。3.在你的query方法里查询数据库,返回的结果是List4.b.jsf代码就是显示代码了,大致如下:<t:dataTable id="CostumerList" var="CostumerEntity"value="#{mbean.costumerList}" ><t:column><f:facet name="header"><h:outputText value="会员编号" /></f:facet><h:outputText value="#{CostumerEntity.costumerid}" escape="true" /></t:column>.....................</t:dataTable>ok了!!!!! ap map = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();map.put("CostumerList", costumerList);,在下一个页面中如何使用大提datatable把数据显示页面。我的写法如下------------------------request表示的是当前请求,但你换到下1个页面的时候就是1个新的请求了,所以你保存到以前请求中的值,不可能在下1个请求中还能取的到。保存到session中就能在下个页面获取.Map map = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();map.put("CostumerList", costumerList); 1.我做了实验,不应该有错啊2.请求页面 <h:commandLink action="#{mbean.query}" target="_blank"> 显示table的页面没有错。 网页表单自动填写并提交 正则表达式必须为小于12位数字?? 级联查询? ▆▆▆▆▆▆ 二进制流 检索问题 ▆▆▆▆▆▆ 请教FTP服务器搭建的问题 JSP一些基础问题?? struts2+hibernate表单提交数据中文乱码,人快疯了,求解 讨论一下WEB应用程序的类的放置问题 在线等待:哪位大哥帮我看看这一段程序(关于分页)。 请问???CSDN的查询功能为什么不能用了呢??? javascript中空格对齐的问题 无法导入servlet包
如你你两个页面和一个managedbean,分别为a.jsf,b.jsf和mbean.
1.a.jsf是你查询条件的页面并有一个commandLink,用于提交,代码大致如下:
<h:commandLink id="link" value="确定" action="#{mbean.query}">如果要提交到新页面请使用以下方法:<h:commandLink id="link" value="确定" action="#{mbean.query}" target="_blank">2.建立managedbean mbean,范围为request即可。在Bean里至少有public String query()方法,返回值为b.jsf的映射字符串,并且有一个属性List costumerList及它的get方法。3.在你的query方法里查询数据库,返回的结果是List
4.b.jsf代码就是显示代码了,大致如下:
<t:dataTable id="CostumerList" var="CostumerEntity"
value="#{mbean.costumerList}" >
<t:column>
<f:facet name="header">
<h:outputText value="会员编号" />
</f:facet>
<h:outputText value="#{CostumerEntity.costumerid}" escape="true" />
</t:column>
...........
..........
</t:dataTable>
ok了!!!!!
map.put("CostumerList", costumerList);
,在下一个页面中如何使用大提datatable把数据显示页面。我的写法如下
------------------------
request表示的是当前请求,但你换到下1个页面的时候就是1个新的请求了,所以你保存到以前请求中的值,不可能在下1个请求中还能取的到。保存到session中就能在下个页面获取.
Map map = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
map.put("CostumerList", costumerList);
2.请求页面 <h:commandLink action="#{mbean.query}" target="_blank">
显示table的页面没有错。