Java Reference
In-Depth Information
LISTING 21.9
Continued
56: <td width=”15%” valign=”top” align=”right”>Your Name:</td>
57: <td width=”50%”><input type=”text” name=”name” size=”40”></td>
58: </tr>
59: <tr>
60: <td width=”15%” valign=”top” align=”right”>Your E-mail Address:</td>
61: <td width=”50%”><input type=”text” name=”email” size=”40”></td>
62: </tr>
63: <tr>
64: <td width=”15%” valign=”top” align=”right”>Your Home Page:</td>
65: <td width=”50%”><input type=”text” name=”url” size=”40”></td>
66: </tr>
67: <tr>
68: <td width=”15%” valign=”top” align=”right”>Your Comments:</td>
69: <td width=”50%”>
70: <textarea rows=”6” name=”comments” cols=”40”></textarea>
71: </td>
72: </tr>
73: </table>
74: <p align=”center”><input type=”submit” value=”Submit” name=”B1”>
75: <input type=”reset” value=”Reset” name=”Reset”></p>
76: <input type=”hidden” name=”id” value=”<%= id %>”>
77: </form>
78: </body>
79: </html>
After you save this page, store it in any folder on your server where JSP pages can be
stored. You can test this even before anything else in the project is done, as long as you
have an empty guestbook file.
To create this file, save an empty text file on your system and give it the name
cinema.gbf . Store it on the Web in the webapps folder relative to where the guestbook
page has been stored. For instance, if the page is in webapps\jspexamples\guestbook.
jsp , the text file should be saved in \webapps\jspexamples .
When you load this JSP page, you must include a parameter that specifies the ID of the
guestbook to load, as in this URL:
http://localhost:8080/jsp-examples/guestbook.jsp?id=cinema
The server name and folder depend on where you have published guestbook.jsp .
21
Figure 21.8 shows what your guestbook looks like when your page compiles successfully
and tries to display the contents of the cinema.gbf file.
 
Search WWH ::




Custom Search