继续请教,现在改的数据已经出来了,但是翻页的actionlistener不执行backbean
fourfire
2008-04-11
<h:dataTable id="books2" value="#{TestBean.otherDataModel}" var="store2"> <h:column> <f:facet name="header"> <h:commandLink id="obj__id" styleClass="Link" title="click sort" value="A列" actionListener="#{TestBean.sortColumn}"> </h:commandLink> </f:facet> <h:outputText value="#{store2.id}"/> </h:column> <h:column> <f:facet name="header"> <h:commandLink id="obj__letter" styleClass="Link" title="click sort" value="B列" actionListener="#{TestBean.sortColumn}"> </h:commandLink> </f:facet> <h:outputText value="#{store2.letter}"/> <h:selectBooleanCheckbox id="td1" styleClass="" value="#{store2.id}" onclick="choose(this,'#{store2.id}')" ></h:selectBooleanCheckbox> </h:column> <h:column> <f:facet name="header"> <h:commandLink id="obj__chinese" styleClass="Link" title="click sort" value="C列" actionListener="#{TestBean.sortColumn}"> </h:commandLink> </f:facet> <h:outputText value="#{store2.chinese}"/> </h:column> <f:facet name="footer"> <h:panelGrid> <h:commandLink value="首页" styleClass="Link" actionListener="#{TestBean.firstPage}"> </h:commandLink> <h:commandLink value="上一页" styleClass="Link" actionListener="#{TestBean.lastPage}"> </h:commandLink> <h:commandLink value="下一页" styleClass="Link" actionListener="#{TestBean.nextPage}"> </h:commandLink> <h:commandLink value="末页" styleClass="Link" actionListener="#{TestBean.endPage}"> </h:commandLink> <h:outputText value="共计#{TestBean.otherDataModel.rowTotalCount}条记录" /> <h:outputText value="第#{TestBean.otherDataModel.currentPage+1}页/共#{TestBean.otherDataModel.pageCount}页" /> <h:commandLink value="导出" styleClass="Link" actionListener="#{TestBean.exportExcel}"> </h:commandLink> <h:commandLink value="查询" styleClass="Link" > </h:commandLink> </h:panelGrid> </f:facet> </h:dataTable> public void firstPage(ActionEvent event) { if (this.getOtherDataModel() instanceof ScrollDataModel) { ScrollDataModel model = ((ScrollDataModel) this.getOtherDataModel()); FacesContext context = FacesContext.getCurrentInstance(); model.setCurrentPage(0); } } public void lastPage(ActionEvent event) { if (this.getOtherDataModel() instanceof ScrollDataModel) { ScrollDataModel model = ((ScrollDataModel) this.getOtherDataModel()); model.setCurrentPage(model.getCurrentPage() - 1); } } public void nextPage(ActionEvent event) { if (this.getOtherDataModel() instanceof ScrollDataModel) { ScrollDataModel model = ((ScrollDataModel) this.getOtherDataModel()); model.setCurrentPage(model.getCurrentPage() + 1); } } public void endPage(ActionEvent event) { if (this.getOtherDataModel() instanceof ScrollDataModel) { ScrollDataModel model = ((ScrollDataModel) this.getOtherDataModel()); model.setCurrentPage(model.getPageCount() - 1); System.out.println(model.getCurrentPage()); } } java方法不执行! |
|
fourfire
2008-04-11
1 怎么检查错误?
|
|
fourfire
2008-04-11
好像没什么错误!
|
|
richmond
2008-04-11
2.执行命令的控件不再form中,所以,网页没有提交数据过来,更不会执行命令控件的动作了!
觉得是这个... 试试看在<h:panelGrid>里面包一层<h:form>? 随便说说的 |
|
fourfire
2008-04-11
找到问题了,是B列,因为他是checkbox
<h:commandLink id="obj__letter" styleClass="Link" title="click sort" value="B列" actionListener="#{TestBean.sortColumn}"> </h:commandLink> </f:facet> <h:outputText value="#{store2.letter}"/> <h:selectBooleanCheckbox id="td1" styleClass="" value="#{store2.id}" onclick="choose(this,'#{store2.id}')" ></h:selectBooleanCheckbox> </h:column> 具体原因待查 |
|
aidiyuxin
2008-07-18
bean里少东西
需要指定排列方式 |