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.

有帮助吗?

解决方案

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!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top