Take the 2-minute tour ×

I'm developing an application using JSF 2.0 and PrimeFaces 3.4. I have two dropdown lists which, depending on what fields are selected, should display the currently selected item in corresponding output texts.

I have an <p:ajax update="outputTextId"> which should trigger when the change is made in the <p:selectOneMenu>. The problem is that the upper dropdown won't ever trigger, but the lower dropdown triggers properly.

Project compiles fine and all data is stored correctly. The backing bean is in the session scope. Here's the relevant Facelets code:

<h:form id="form">
    <p:selectOneMenu id="subTypePickList" value="#{MappingBean.selectedSubtype}" valueChangeListener="#{MappingBean.changeListenerSubType}">
        <p:ajax event="change" update="testSubTypeOut, itemList, queryArea, outputDisplayName" />
        <f:selectItem itemLabel="Select Field" itemValue=""/>
        <f:selectItems value="#{MappingBean.mappingStrings}" />            
    <p:inputTextarea id="queryArea" value="#{MappingBean.expression}" />
    <p:selectOneMenu id="fieldPickList3" value="#{MappingBean.selectedFieldType}" valueChangeListener="#{MappingBean.changeListenerField}">
        <p:ajax event="change" update="fieldPickList3, itemList, queryArea, outputDisplayName, testSubTypeOut"/>      
        <f:selectItem itemLabel="Select Field to Update" itemValue=""/>
        <f:selectItems value="#{MappingBean.mappingStrings}" />               
    <h:outputText id="testSubTypeOut" value="#{MappingBean.selectedSubtype}" />
    <h:outputText id="outputDisplayName" value="#{MappingBean.selectedFieldType}" />  
    <p:commandButton id="executeButton" value="Execute" />

How is this caused and how can I solve it?

Backing Bean: Ive deleted a lot out that is not relevant to the particular problem.

@ManagedBean(name = "MappingBean")
public class MappingBean {
private String selectedSubType;
private String selectedFieldType;
public MappingBean() {

Next part is just getting a list of strings from a cloud application.


    public String getSelectedSubtype(){
    return selectedSubType;
public String getSelectedFieldType(){
    return selectedFieldType;


public void setSelectedSubType(String selectedSubType){
    this.selectedSubType = selectedSubType;
public void setSelectedFieldType(String selectedFieldType){
    this.selectedFieldType = selectedFieldType;

Change Listeners:

    public void changeListenerSubType(ValueChangeEvent event){ 
    selectedSubType = event.getNewValue().toString();
    public void changeListenerField(ValueChangeEvent event){  
    selectedFieldType = event.getNewValue().toString();

Hope thats better I cut out what I thought was pretty irrelevant


share|improve this question
The cause is most likely in those value change listeners. So some backing bean code would be helpful to understand why you are using them like that. Edit your question to include it. Please make sure to post only the relevant(!) code and remove any code noise. Your initial question had a lot of irrelevant style attributes and label and panel components in your code which made your code like a forest. See also stackoverflow.com/tags/jsf/info for some hints. –  BalusC Dec 11 '12 at 17:19
Done I tried to cut it down to bare minimums, hopefully its not too bad –  reggie morgan Dec 12 '12 at 8:30
Also would be important to note that the values for the selected item in the pick list are being stored correctly and exactly when I select them, however I need to press f5 before the outputText will display this value (or alternatively to f5, use the lower selectOneMenu to update the 2 outputText fields values). –  reggie morgan Dec 12 '12 at 8:34
Those value change listener implementations are very strange. They do baiscally nothing useful. This job is already done by JSF itself during update model values phase. Get rid of them. –  BalusC Dec 12 '12 at 11:27
Hi Balus, Actually the value change listeners are used to set the currently selected Item in the mapping bean, and then the outputText field is suppose to simply Get that set selectedItem. However as I was writing this reply I tried deleting the "value="#{mappingBean.getSubType}", and what do you know it works, If you want to edit your comment and suggest instead to delete the value= and keep value change listener I will set it as the Answer for this topic as its basically the same idea. As always thank you for your help ! –  reggie morgan Dec 12 '12 at 12:39

Your Answer



Browse other questions tagged or ask your own question.