Getting Started with Enterprise JavaBeans™

G

Appendix C

Tutorial Home Section Home Previous Next

Get

Get

The Rock Survey Application

     Alice's Rock Survey is the primary example application in the tutorial. Much as happens in practice, the application goes through several iterations before it is a finished product. Each iteration introduces a different type of Enterprise JavaBean and functionality to the application.

     In Example: The Rock Survey, Take 1, the Rock Survey uses a stateful session bean to handle the business methods for collecting the survey data. The session bean also acts as a dummy data store in this version; there is no actual persistence at this point. In Example: The Rock Survey, Take 2, an entity bean is added, which uses BMP for persisting the SurveyNames table data. In Example: The Rock Survey, Take 2 (continued), another entity bean uses CMP for persistence with the "SurveyBeanTable" table. In the final iteration, Example: The Rock Survey, Take 3, a message-driven bean is added to allow asynchronous updates to the database.

     The application begins with a "welcome to Alice's surveys" page that collects data appropriate to all surveys and gives the user — let's call her Chrissie — an opportunity to return to the home page. At this point, of course, there is only have one survey, the Rock Survey.

Figure C-3: Survey Application — Welcome
Survey application — Welcome

     The logic for purposes of the example is:


     After entering the initial data, Chrissie presses the Go button and the Rock Survey welcome page is displayed. This page asks her to verify the data entered and allows a return to the previous page for corrections.

Figure C-4: Rock Survey Application — Welcome
Rock Survey application — Welcome


     If Chrissie is happy with her entries, she presses the Next button, which causes the actual Rock Survey page to be displayed.


Figure C-5: Rock Survey Application — Survey
Rock Survey application — Survey


     This page collects and validates the actual survey data. All entries here are straightforward, except that the weight of the rocks is always kept in pounds in the database. Once the entries are made, Chrissie presses the Next button, and the Rock Survey "Thank You" page is displayed.


Figure C-6: Rock Survey Application — Thank You
Rock Survey application — Thank You

     The "Thank You" page asks her to verify the input data and allows a return to the previous page for corrections. If the entries are satisfactory, she presses the Done button, which causes the data to be stored, invalidates the servlet session, and returns control to the Alice's World home page.



Tutorial Home Section Home Previous Next