문제

Using Primefaces 3.1.1.

I am trying to perform two actions on submit of 1 commandButton:

The original form elements are as follows:

<p:calendar ... value="#{bean.date1}" />
<p:calendar ... value="#{bean.date2}" />
<h:commandButton value="submit" onchange="TASK" action="#{Bean.saveOrUpdateItem()}" >
</h:commandButton>

But now, I would also like to achieve the following with the press of that same button:

<h:commandButton value="submit" action="#{bean.submit}">
    <f:ajax execute="@form" render="result" />
</h:commandButton>
<h:outputText id="result" value="#{bean.date3}" />

Any pointers on how to deal with that? I do not want to modify the first Bean.saveOrUpdateItem() and have to create the second bean.

Thank you in advance.

-V

도움이 되었습니까?

해결책

Try to use f:actionListener

<h:commandButton value="Submit" id="submit" action="#{myBean0.action}" >
       <f:actionListener binding="#{myBean1.actionListener}"/>
            <f:actionListener binding="#{myBean2.actionListener}"/>
</h:commandButton>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top