Domanda

I have select menu in JSF xhtml page. The select menu contains a

<h:selectOneMenu value="#{bean.statusFlag}">

    <f:selectItems value="#{bean.statusList}"/>
 </h:selectOneMenu>

The value is be being stored in status.

This works fine. I have to print the value in h:outputText in next column.

<h:outputText value="#{bean.statusFlag}" />

prints code rather value corresponding value of code, since the value is in statusList.

Is there any way to achieve this without having to modify the backing bean.

È stato utile?

Soluzione

You could perhaps implement some sort of <f:ajax> within your <h:selectOneMenu>.

You could also use jquery with an onchange() event.

$('#select').change(function() {
    $('#outText').val($('#select').val());
});

Hope that helps!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top