Buddhika Ariyaratne
Buddhika Ariyaratne

Reputation: 2433

Printing with an action

How to execute an action or actionListner method alone with a print action. For example, is it possible to print a bill and mark the print bill as printed by a back bean method without clicking two buttons?

<h:commandButton value="Print" actionListener="#{labBillController.markAsPrinted()}" >
    <p:printer target="panelBill" ></p:printer>
</h:commandButton>

Both actions of above code are not happening simultaneously. If ajax used , actionListner methos is executed. If non ajux, only printing, but no execution of Method.

Upvotes: 1

Views: 1338

Answers (1)

Andy
Andy

Reputation: 6598

Use this

<h:commandButton value="Print" actionListener="#{labBillController.markAsPrinted()}" >
    <f:ajax execute="@this" />
    <p:printer target="panelBill" />
</h:commandButton>

Upvotes: 1

Related Questions