19.09.2015 Views

Prentice.Hall.Introduction.to.Java.Programming,.Brief.Version.9th.(2014).[sharethefiles.com]

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<br />

}<br />

The managed bean has three properties number1, number2, and result<br />

(lines 9-38). The methods add(), subtract(), divide(), and multiply()<br />

add, subtract, multiply, and divide number1 with number2 and assigns the<br />

result <strong>to</strong> result (lines 40-54).<br />

Listing 44.8 Calcula<strong>to</strong>r.xhtml<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Calcula<strong>to</strong>r<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Three text input <strong>com</strong>ponents along with their labels are placed in the<br />

grid panel (lines 11-24). Four but<strong>to</strong>n <strong>com</strong>ponents are placed in the grid<br />

panel (lines 26-35).<br />

The bean property number1 is bound <strong>to</strong> the text input for Number 1 (line<br />

15). The CSS style text-align: right (line 14) specifies that the text<br />

is right-aligned in the input box.<br />

22

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!