java - Can i call a method and redirect to another page together from p:commandLink -
is possible call java method , redirect .xhtml page 1 p:commandlink @ same time , how?
my commandlink is:
<p:commandlink value="click here" action="#{userrequestbean.cancelrequest()}" update = ":datagrid" > <f:setpropertyactionlistener target="#{userrequestbean.request}" value="${useractiverequest}" /> </p:commandlink>
and when click link, redirected page (as call java method)
add navigation in faces-config.xml
<navigation-rule> <navigation-case> <from-outcome>cancelrequest</from-outcome> <to-view-id>/cancelledrequest.xhtml</to-view-id> <redirect /> </navigation-case> </navigation-rule>
now in managed bean :
public string cancelrequest(){ //do logic here return "cancelrequest"; }
now if press commandlink redirect cancelrequest.xhtml.
Comments
Post a Comment