O'Reilly logo

IBM Rational Application Developer V6 Portlet Application Development and Portal Tools by Ryan Wilson, Gianfranco Rutigliano, George Kroner, Belen Gonzalez, Karla Galvan, Cristiano Cesario, Juan R. Rodriguez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

1.
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 "";
2.
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() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required