Hi,
I am new to
JSF, I need to populate input text box with the label of the radio selected.
Following is extract from my code, my issue is that the Text Box is not getting populated with the value selected,please help.
<p><h:selectOneRadio id="formatSelectRadio"
value="#{test.formatName}"
valueChangeListener="#{test.formatOptionChangeListener}"
onclick="submit()"
immediate="true">
<f:selectItem id="summaryOption" itemLabel="Summary Student Information"
itemValue="Summary Student Information" />
<f:selectItem id="extendedOption" itemLabel="Extended Student Information"
itemValue="Extended Student Information" />
</h:selectOneRadio></p>
<p><h:outputLabel for="fileName"
value="Enter your file name " /> <h:inputText
id="fileName" value="#{test.fileName}">
</h:inputText></p>
//////// BAcking bean ////////
public
String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public final void formatOptionChangeListener(final ValueChangeEvent event) {
if (LOG.isDebugEnabled()) {
LOG.debug("Firing formatOptionChangeListener...");
}
HtmlSelectOneRadio radio = (HtmlSelectOneRadio) FacesContext.getCurrentInstance().getViewRoot().findComponent("dataForm:formatSelectRadio");
if (radio.getValue().toString().equals("Summary Student Information")) {
setFileName("Summary Student Information");
System.out.println("FILENAME 2 " + getFileName());
} else if (radio.getValue().toString().equals("Extended Student Information")) {
setFileName("Extended Student Information");
System.out.println("FILENAME 3 " + getFileName());
}
// return getFileName();
}