xml代码:
<h:commandButton id="editbutton" action="edit" image="/images/EDIT.jpg" actionListener="# {search.edit}"> <f:attribute name="ehrid" value="#{result.ehr_id}"/></h:commandButton>
页面跳转通过faces-config.xml文件来实现:
<navigation-rule> <from-view-id>/pages/personalinfoselect.xhtml</from-view-id> <navigation-case> <from-outcome>edit</from-outcome> <to-view-id>/pages/personalinfoedit.xhtml</to-view-id> </navigation-case></navigation-rule>
参数传递actionListener事件来实现,后台代码:
public void edit(ActionEvent event){ String ehruser = (String) event.getComponent().getAttributes().get("ehrid"); System.out.println("ehrusermap="+ehruser);}
转载于:https://www.cnblogs.com/Catherinezhilin/p/9909783.html
相关资源:JAVA上百实例源码以及开源项目