Question

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.

Was it helpful?

Solution

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!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top