ContentsApplication DesignExecution cycle
Previous: Thin pipes | Next: Usage scenarios

Execution cycle

Our web clients communicate with the server-side components through HTTP. Since HTTP is a stateless protocol (meaning that there is no connection that is held from one screen to the next) we may need to save something on the client to identify it. On each successive screen of our application, we can use this identification to associate the user with their state and information that we've gathered from them so far.

This piece of information is a cookie. There is another approach that we could use, where we embed the identification into each web page that we send back (using a hidden form field); but the Java Servlet API gives us a handy mechanism that abstracts the cookies. This mechanism is called a "session".

When the user's web browser comes to our application, we will ask for their name and give them a cookie by instancing a new HttpSession object. In most servlet engines, this session object will automatically keep track of the user for us. We can store any additional objects about the session by using the methods provided on the session object.

In the case of our example, the user will first sign in, then will be provided with a form that lets them enter five years worth of data. This form also gives them three buttons where they can:

With the PDF plug-in active, the application loses it's ability to provide navigation; so the best thing to do is to put the chart into an additional browser window. The user can then close the browser window or keep it around for comparison with subsequent presses of the "Chart" button.

Here's what the application looks like at this point -> code / output

Some points to ponder:

The servlet has the interaction behavior we want at this point, but no real output. Read on.


ContentsApplication DesignExecution cycle
Previous: Thin pipes | Next: Usage scenarios