Java Reference
In-Depth Information
The pay method returns the page to which the action is redirected, response.xhtml .
The PaymentBean class also contains a reset method that empties the value field on
the index.xhtml page and sets the payment option to the default:
@Logged
public void reset() {
setPaymentOption(DEBIT);
setValue(BigDecimal.ZERO);
}
In this bean, only the pay and reset methods are intercepted.
The response.xhtml page displays the amount paid. It uses a rendered expression
to display the payment method:
Click here to view code image
<h:body>
<h:form>
<h2>Bill Payment: Result</h2>
<h3>Amount Paid with
<h:outputText id="debit" value="Debit Card: "
rendered="#{paymentBean.paymentOption eq
1}" />
<h:outputText id="credit" value="Credit Card: "
rendered="#{paymentBean.paymentOption eq
2}" />
<h:outputText id="result" value="#{paymentBean.value}" >
<f:convertNumber type="currency"/>
</h:outputText>
</h3>
<p><h:commandButton id="back" value="Back" action="index"
/></p>
</h:form>
</h:body>
The LoggedInterceptor Interceptor Class
The interceptor class, LoggedInterceptor , and its interceptor binding, Logged , are
both defined in the interceptor package. The Logged interceptor binding is defined
as follows:
@Inherited
-@InterceptorBinding
@Retention(RUNTIME)
@Target({METHOD, TYPE})
Search WWH ::




Custom Search