Java Reference
In-Depth Information
FIGURE 21.8
Testing the guest-
book.jsp page.
The guestbook file stores each guestbook entry on its own line, with a caret ('^') separat-
ing each field in the entry. Visitors can provide their name, email address, home page
address, and a comment. Two other things are saved for each entry: the date and time it
was written and the IP address of the visitor.
The following text is an example of a guestbook file that contains one entry:
Puddin N. Tane^puddin@example.com^None^Sat Feb 24 18:29:17 EST
2007^127.0.0.1^Ask me again and I'll tell you the same.
The next JSP page to create is guestbook-post.jsp , the page that updates the guestbook
with new entries submitted by visitors. Listing 21.10 contains the source code for this
page.
LISTING 21.10
The Full Text of guestbook-post.jsp
1: <%@ page import=”java.util.*,java.io.*,example.*” %>
2: <html>
3: <head>
4: <title>Thank You For Signing Our Guestbook</title>
5: </head>
6: <body>
7: <h3>Thank You For Signing Our Guestbook</h3>
8: <%
9: String id = request.getParameter(“id”);
Search WWH ::




Custom Search