jsf 2 - Navigate without redirect? -


i have navigation-menu:

... <p:menuitem id="id1" value="page 1" action="home.xhtml?faces-redirect=true" actionlistener="#{homebean.somemethod(1)}"/> <p:menuitem id="id2" value="page 2" action="other.xhtml?faces-redirect=true" actionlistener="#{otherbean.somemethod(1)}"/> 

now want rid of these redirects. tried attribute url instead of action, actionlistener isn't called anymore.

how can call listener in case

<p:menuitem id="id1" value="page 1" url="home.jsf">   ... here (or maybe somewhere else) should go call listener ... </p:menuitem> 

jonny

the p:menuitem supports post , get. 1 of these selected depends on presence of url attribute. quote pf documentation:

this decided url attribute, if present menuitem request, if not parent form posted.

if want invoke action method on server side need post. if don't want redirect, need return navigation target string action method:

public string someaction() {   ...   return "home"; }  

this navigatio home.xhtml if action method has finished.

you can call action method menu:

<p:menuitem id="id1" value="page 1" action="#{somebean.someaction}"/> 

Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -