The structure of our application looks like this:

This design allows for a continuing conversation between the
client, the main JSP, the main bean, and output JSPs. The idea is
that a JSP functioning as an output template contains a form (or a
<go> element) whose action attribute is the URL of the main
JSP. The main weather.jsp page acts as a switchboard to which all
requests are sent, and which forwards them to the right output
JSP.
The main JSP interacts with the main bean using two string
variables: beanCmd and jspCmd. beanCmd determines what kind of
action the bean executes, while jspCmd determines the output
template that the main JSP selects for sending back the response.
Most of those output template pages contain an XHTML form (or a WML
<p> element) with appropriate elements for input. The action
attribute of the form (or the href attribute of the WML <go>
element) is the URL of the main JSP.
I will work through this diagram, selectively looking at
components. The goal is to learn enough JSP and JDBC to be able to
use the framework and develop your own applications of similar
structure. We'll start with the WML entry page, weather.wml.
The WML Entry Page
Here's the WML code for the first two microbrowser screens we
saw, a WML deck consisting of a single card:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//PHONE.COM//DTD WML 1.1//EN"
"http://www.phone.com/dtd/wml11.dtd">
<wml>
<card id="start" title="Weather">
<do type="accept" label="Go!"
>
<go
href="weather.jsp"><!-- submitted to a JSP -->
<postfield name="query" value="$query" />
<postfield name="QP1" value="$QP1" />
<postfield name="target" value="wml-$(query)" />
</go>
</do>
<p align="center">Weather
Page</p>
<p>
Zip?
<input
name="QP1" format="*N" maxlength="10" value="" /><br
/>
Query?
<select
name="query">
<option value="TimeTemp" > time & temp
</option>
<option value="AllTable" > all fields </option>
<option value="AllText" > all fields
format</option>
</select>
</p>
</card>
</wml>
Here's the WML code for the third screen we saw above:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//PHONE.COM//DTD WML 1.1//EN"
"http://www.phone.com/dtd/wml11.dtd">
<wml>
<head>
<meta
http-equiv="Cache-Control" content="no-cache" forua="true"/>
</head>
<card id="output" title="AllTable">
<do type="accept"
label="again" >
<go
href="#askCard" />
</do>
<p>Weather:</p>
<p>
<table
columns="2">
<tr>
<td>Zip</td><td>13346</td>
</tr>
<tr>
<td>Day</td><td>03/12/2000</td>
</tr>
<tr>
<td>RecTime</td><td>1:40 PM </td>
</tr>
<tr>
<td>Temp</td><td>37</td>
</tr>
<tr>
<td>DayLo</td><td>35 </td>
</tr>
<tr>
<td>DayHi</td><td>46 </td>
</tr>
<tr>
<td>Precip</td><td>60</td>
</tr>
<tr>
<td>Warn</td><td>Foggy, probable rain; caution in
driving</td>
</tr>
<tr>
<td>Tomorrow</td><td>We won't have any weather
tomorrow</td>
</tr>
<tr>
<td>NextDay</td>
<td>There will be weather nearby, but not on
you.</td>
</tr>
</table>
</p>
</card>
<card id="askCard" title="Weather">
<do type="accept" label="Go!"
>
<go
href="weather.jsp">
<postfield name="query" value="$query" />
<postfield name="QP1" value="$QP1"
/>
<postfield name="target" value="wml-$(query)" />
</go>
</do>
<p align="center">Weather
Page</p>
<p>
Zip?
<input name="QP1" format="*N" maxlength="10" value="" />
<br
/>
Query?
<select
name="query">
<option value="TimeTemp" > time & temp
</option>
<option value="AllTable" > all fields </option>
<option value="AllText" > all fields-format
</option>
</select>
</p>
</card>
</wml>