Hi,
I am writing a JSF portlet. When I change the value of the radio button I am trying to get a textOutput component set to the value of what I have just selected. (For a change im trying to walk before I can run, before I use this value in more complex code I would like to make sure I can get it first!, which incidently I can't). The problem is that when I select a new value from the radio list, the page is submitted but the outputText component does not change. I also have a System.out in the listener method but this does not appear in the console. I have come to the idea that this method for some eason isn't being called but I am at a loss as to why not.
Any help is greatly appreciated.
Thanks
Craig
I have the following selectOneRadio component, it takes in an SelectItem[] full of names. Its value is defaultly set to the first name in the list. I don't change this currentBusinessReason value so I know the selected value will always be the first in the list after the page is reloaded, but the outputText component should be given the new value. (This is what I will change with the setCurrentBusinessReason method when ive learnt how to run!).
<h:selectOneRadio
styleClass="selectOneRadio"
id="brSelectOneRadio"
layout="pageDirection"
value="#{pc_JSFProductCatalogueView.currentBusinessReason.name}"
valueChangeListener="#{pc_JSFProductCatalogueView.handleBrSelectOneRadioValueChange}"
onclick="submit()"
immediate="true">
<f:selectItems
value="#{pc_JSFProductCatalogueView.businessReasonsSelectItems}" />
</h:selectOneRadio>
This is the valueChangedListener method in my bean:
public void handleBrSelectOneRadioValueChange(ValueChangeEvent valueChangedEvent) {
System.out.println("handleBrSelectOneRadioValueChange");
setSelectedValue((String)valueChangedEvent.getNewValue());
}
I have this as my outputText control, there are the methods getSelectedValue and setSelectedValue in my managed bean:
<B>You selected:</B><BR>
<h:outputText
styleClass="outputText"
id="outputSelected"
value="#{pc_JSFProductCatalogueView.selectedValue}">
</h:outputText>
This is my bean in faces-config.xml
<managed-bean>
<managed-bean-name>pc_JSFProductCatalogueView</managed-bean-name>
<managed-bean-class>pagecode.JSFProductCatalogueView</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>