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

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -