0

A basic problem, i guess, but i cannot get it to work: with changing the selection in primefaces selectoneradio a backing bean should be called and afterwards a new page should be loaded. as there is no action attribute, how can i solve this?

i also tried to solve it with f:ajax, but could not get it to work

jsf:

<p:selectOneRadio value="#{controller.selectedValue}">
   <f:selectItems value="#{controller.getListValues()}" var="item"/>
   <f:ajax event="click" listener="#{controller.execute()}"/>
</p:selectOneRadio>

backing bean:
public String execute() {
   doSomething();
   return "new-page.jsf"; 
}

so what i want to have is, that the user clicks on a radio button, something should be executed, and the outcome is then new-page.jsf

crossl
  • 1
  • 3
  • Hi, please always try to break down the problem. 1: Is it actually PrimeFaces related or does it fail with a plain `h:selecctOneRadio` too? 2: IS it related to a `selectOneRadio` or does it fail with an `h:inputText` too? Or with an `h:commandButton`? Effectively it is a 'how do I navigate after an ajax' call for which the duplicate is your answer – Kukeltje Feb 08 '19 at 10:26
  • 1
    Possible duplicate of [JSF 2: page redirect after ajax call](https://stackoverflow.com/questions/7927303/jsf-2-page-redirect-after-ajax-call) – Kukeltje Feb 08 '19 at 10:26
  • there is no commandbutton used, thats the problem! outcome of a radio change should be a new page if i would know where it fails, i wouldn't need to post! sorry, but to my opinion i described the problem clearly and no, its not duplicate - as i said, there is no commandbutton available – crossl Feb 08 '19 at 10:52
  • 2
    Like I said, your actual problem is not related to a type of input or button (or link), it is related to the navigation from an ajax action listener. But I see I posted copy/pasted the wrong link... It should have been https://stackoverflow.com/questions/18589616/sending-a-redirect-from-inside-an-ajax-listener-method – Kukeltje Feb 08 '19 at 11:41
  • aah! right! works and thanks! – crossl Feb 12 '19 at 21:46

0 Answers0