background image

The managed-bean element

<< The CoffeeBreakBean JavaBeans Component | Setting the Port >>
<< The CoffeeBreakBean JavaBeans Component | Setting the Port >>

The managed-bean element

com.sun.cb.CheckoutFormBean
</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>firstName</property-name>
<value>Coffee</value>
</managed-property>
<managed-property>
<property-name>lastName</property-name>
<value>Lover</value>
</managed-property>
<managed-property>
<property-name>email</property-name>
<value>jane@home</value>
</managed-property>
...
</managed-bean>
<navigation-rule>
<from-view-id>/orderForm.jsp</from-view-id>
<navigation-case>
<from-outcome>checkout</from-outcome>
<to-view-id>/checkoutForm.jsp</to-view-id>
</navigation-case>
</navigation-rule>
As shown in the managed-bean element, the checkoutForm bean properties are initialized with
the values for the user, Coffee Lover. In this way, the hyperlink tag from orderForm is not
required to submit these values in the request parameters.
As shown in the navigation-rule element, when the String, checkout, is returned from a
method referred to by a component's action attribute, the checkoutForm page displays.
Building, Packaging, Deploying, and Running the Coffee
Break Application
The source code for the Coffee Break application is located in the directory
tut-install/javaeetutorial5/examples/coffeebreak/. Within the cb directory are
subdirectories for each web application (cb, cb-saaj, and cb-jaxws) and a directory,
cb-common
, for classes shared by the web applications. Each subdirectory contains a build.xml
file. The web application subdirectories in turn contain a src subdirectory for Java classes and
configuration files, and a web subdirectory for web resources.
Building, Packaging, Deploying, and Running the Coffee Break Application
Chapter 36 · The Coffee Break Application
1051