Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdate Datalist value in primefaces
    primarykey
    data
    text
    <p>i am using primefaces datalist , it contains list binded with it ,, datalist contains radio button i want to change / update values of that binded list i tried this code but its not working </p> <pre><code>&lt;p:dataList var="question" value="#{formTableBean.question}" type="definition" &gt; &lt;h:outputText value="#{question.text}" style="font-size:14px;font-weight:bold" /&gt; &lt;h:panelGrid columns="2" width="100%" style="margin-bottom:10px" cellpadding="10"&gt; &lt;h:outputText value="Options: " /&gt; &lt;p:selectOneRadio id="options" value="#{question.answer}" &gt; &lt;f:selectItem itemLabel="Strongly Agree" itemValue="1" /&gt; &lt;f:selectItem style="margin-right:20px" itemLabel="Agree" itemValue="2" /&gt; &lt;f:selectItem style="margin-right:20px" itemLabel="Disagree" itemValue="3" /&gt; &lt;f:selectItem itemLabel="Strongly Disagree" itemValue="4" /&gt; &lt;p:spacer width="100"&gt;&lt;/p:spacer&gt; &lt;/p:selectOneRadio&gt; &lt;/h:panelGrid&gt; &lt;/p:dataList&gt; </code></pre> <p>bean class package Bean;</p> <pre><code>import java.util.ArrayList; import java.util.List; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import javax.faces.bean.ViewScoped; import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; import com.liferay.portal.model.User; import com.liferay.portal.service.UserLocalServiceUtil; import DAO.Dao; import DTO.FormDTO; import DTO.QuestionDTO; @ManagedBean @ViewScoped public class FormTableBean { FormDTO selectedForm; List&lt;QuestionDTO&gt; question; public List&lt;QuestionDTO&gt; getQuestion() { return question; } public void setQuestion(List&lt;QuestionDTO&gt; question) { this.question = question; } public FormDTO getSelectedForm() { return selectedForm; } public void setSelectedForm(FormDTO selectedForm) { this.selectedForm = selectedForm; } boolean renderFormPanal = false; public boolean getRenderFormPanal() { return renderFormPanal; } public void setRenderFormPanal(boolean renderFormPanal) { this.renderFormPanal = renderFormPanal; } List&lt;FormDTO&gt; formList; public List&lt;FormDTO&gt; getFormList() { return formList; } public void setFormList(List&lt;FormDTO&gt; formList) { this.formList = formList; } Dao daoclass = new Dao(); public FormTableBean() { User u = getCurrentUser(); String email = u.getEmailAddress(); int eid = daoclass.emailToEid(email); formList = new ArrayList&lt;FormDTO&gt;(); formList = daoclass.getAllForm(eid); } protected User getCurrentUser() { User u = null; FacesContext fc = FacesContext.getCurrentInstance(); ExternalContext externalContext = fc.getExternalContext(); Long id = Long.parseLong(externalContext.getUserPrincipal().getName()); try { u = UserLocalServiceUtil.getUserById(id); } catch (com.liferay.portal.kernel.exception.PortalException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (com.liferay.portal.kernel.exception.SystemException e) { // TODO Auto-generated catch block e.printStackTrace(); } return u; } public void showForm() { question = new ArrayList&lt;QuestionDTO&gt;(); setRenderFormPanal(true); int formid = selectedForm.getFid(); question = daoclass.getQuestion(formid); } public void saveForm() { for (int i = 0; i &lt; question.size(); i++) { System.out.print("QID:"+question.get(i).getAnswer()); } } } </code></pre> <p>i want to get answers value updated in list .please help me</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload