Hi,
Thanks Ali for the reply.
Here's the jsp code:
<h:dataTable value="#{requirementBean.questionList}" var="questions" id="questionTable" columnClasses="none,tableRowOdd" rowClasses="tableRowEven,tableRowOdd"
cellpadding="1" cellspacing="1" width="100%">
<h:column >
<h:outputText value="#{questions.questionText}" rendered="#{questions.displayType ne '
String'}" />
<h:outputText value="#{questions.questionText}" rendered="#{questions.displayType eq 'String'}" styleClass="divheader" style="width: 100%;"/>
</h:column>
<h:column>
<h:graphicImage url="../../images/spacer.gif" width="1%" />
<h:inputText rendered="#{questions.displayType eq 'TextBox'}" id="inputTextid" value="#{questions.defaultAnswerString}"
validator="#{requirementBean.validateInput}" />
<h:selectOneMenu value="#{questions.defaultAnswerInteger}" rendered="#{questions.displayType eq 'DropDown'}"
id="selectOneMenuid" valueChangeListener="#{requirementBean.valueChangeSelectOneMenu}">
<f:selectItems value="#{questions.option}" />
</h:selectOneMenu>
<h:selectManyListbox size="5" value="#{questions.defaultAnswerArray}" rendered="#{questions.displayType eq 'MDropDown'}"
id="selectManyListboxid" valueChangeListener="#{requirementBean.valueChangeSelectManyListbox}" >
<f:selectItems value="#{questions.option}" />
</h:selectManyListbox>
<h:selectOneRadio value="#{questions.defaultAnswerInteger}" rendered="#{questions.displayType eq 'RadioButton'}" id="selectOneRadioid">
<f:selectItems value="#{questions.option}"/>
</h:selectOneRadio>
<h:selectManyCheckbox value="#{questions.defaultAnswerArray}" rendered="#{questions.displayType eq 'CheckBox'}"
id="selectManyCheckboxid" valueChangeListener="#{requirementBean.valueChangeSelectManyCheckbox}">
<f:selectItems value="#{questions.option}" />
</h:selectManyCheckbox>
</h:column>
</h:dataTable>
=========================================================
Here's the
java code that is written in the managed bean.
/**
* valueChangeSelectOneMenu
*
* @param ValueChangeEvent evt
*
* puts the selected value of drop down into a List
*/
public void valueChangeSelectOneMenu(ValueChangeEvent evt) {
selectedValueOfDropDown.add((Integer) evt.getNewValue());
}
/**
* valueChangeSelectManyListbox
*
* @param ValueChangeEvent evt
*
* Puts the selected answer which is array of Integer into List
*/
public void valueChangeSelectManyListbox(ValueChangeEvent evt) {
// evt.getNewValue() This comes as array of integer
valueMultipleSelectList.add(evt.getNewValue());
}
/**
* valueChangeSelectManyCheckbox
*
* @param ValueChangeEvent evt
*
* Puts the selected answer which is array of Integer into List
*/
public void valueChangeSelectManyCheckbox(ValueChangeEvent evt) {
valueSelectManyCheckbox.add(evt.getNewValue());
}
Hope this make the things more clear.
Please let me know if things are stil not clear.
Thanks & Regards
Ved