17.6. Invoking the business logic of the calculator

To actually use the calculator, you have to invoke the calculate method of the bean when Calculate is clicked.

In the Page Designer, select the Calculate button. In the Quick Edit view, select Command in the left pane. Click in the right pane and this sample code appears:
// Type Java code that runs when the component is clicked
// TODO: Return outcome that corresponds to a navigation rule
return "";
Replace the generated action code with the code shown in Example 17-1.
Example 17-1. Action code to invoke the calculate method
log("CalculateAction start"); try { getCalculator().calculate(); } catch (Exception e) { log("Calculator-Exception: "+e.getMessage()); if (getCalculator().getErrorMessage() ...

Get IBM Rational Application Developer V6 Portlet Application Development and Portal Tools now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.