jsf 2 - how to pass result 'repeat'-'h:selectOneRadio' to List on Backing bean,using Ajax -


this question has answer here:

how pass result of <ui:repeat> <h:selectoneradio> in list on backing bean, using ajax?

<h:form rendered="#{lessonbean.test!=null}">       <ui:repeat value="#{lessonbean.test.questions}" var="quest">              <h:selectoneradio value="">                      <f:selectitem itemvalue="1" itemlabel="${quest.a1}"/>                      <f:selectitem itemvalue="2" itemlabel="${quest.a2}"/>                      <f:selectitem itemvalue="3" itemlabel="${quest.a3}"/>                      <f:selectitem itemvalue="4" itemlabel="${quest.a4}"/>                      <f:selectitem itemvalue="5" itemlabel="${quest.a5}"/>             </h:selectoneradio>       </ui:repeat> </h:form> 

if lessonbean.test.questions list of question objects, can add question class new integer field called answer (with getters , setters) , like:

<h:form rendered="#{lessonbean.test!=null}">       <ui:repeat value="#{lessonbean.test.questions}" var="quest">              <h:selectoneradio value="#{quest.answer}">                      <f:ajax event="click" process="@this" update="@this">                      <f:selectitem itemvalue="1" itemlabel="${quest.a1}"/>                      <f:selectitem itemvalue="2" itemlabel="${quest.a2}"/>                      <f:selectitem itemvalue="3" itemlabel="${quest.a3}"/>                      <f:selectitem itemvalue="4" itemlabel="${quest.a4}"/>                      <f:selectitem itemvalue="5" itemlabel="${quest.a5}"/>             </h:selectoneradio>       </ui:repeat> </h:form> 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -