java - selectOneRadio with action immediately after click -


This should be easy for the pro:

I am using JSF / Facet / SIM After trying to display the radiobutton I am trying, after the user clicks on a button, the value must be saved and the user should be promptly redirected to another page (such that there is no necessary click on the submit button ).

The radio button works, but not forwarding.

Thanks

You can actually use the richface:

  & lt; H: SelectionOnReady value = "# {myBean.myValue}" ... ... ... & lt; A4j: support event = "onclick" action = "# {myBean.doSomething}" /> & Lt; / H: selectOneRadio & gt;  

In your Java code:

  public string doSomething () {// Your code goes here ... ... // Now, we Going forward, return to the new page "some-result"; }  

However, if you can not (or do not want to) add a new library, you can do it in an old way:

 < Code> & lt; H: SelectOneRadio value = "# {myBean.myValue}" ... click on = "this.form.submit ();" ValueChangeListener = "# {myBean.doSomething}" & gt; ... and & lt; / H: Selectionone Radio & gt;  

This code will submit the form where click on when the javascript event is detected and the radio button is included. On the server side, the action takes place something will be executed. In this method, you can create a navigation rule to execute:

  Public Zero doSomething (ValueChangeEvent evt) {// Your code goes here ... ... // Now , We move on to another page ... FacesContext reference = FacesContext.getCurrentInstance (); NavigationHandler Navigation = Reference.GetApplication (). GetNavigationHandler (); Navigation.handleNavigation (reference, "", "some-result"); }  

Where some results are defined in a facial-config.xml in the navigation rule.


Comments