|
NOTE:
These slides have not been updated since 2003. They have been superseded by the book
Anders Møller and Michael Schwartzbach, February 2006 |
|
| INTERACTIVE WEB SERVICES WITH JAVA |
|
Example Servlet receiving the original request:
public class Register extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
String email = request.getParameter("email");
HttpSession session = request.getSession(true);
session.setAttribute("email", email);
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/present.jsp");
dispatcher.forward(request, response);
}
}
|
JSP page producing the final response:
<html><head>mailing list</head><body>
<h1>Welcome!</h1>
You have registered the following address:
<tt><%= session.getAttribute("email") %></tt>
<p><a href="continue">Continue</a>
</body></html>
|
- this quickly becomes a mess...
Often, applications are composed of JavaBean Components.
|
| COPYRIGHT © 2002-2003 ANDERS MØLLER & MICHAEL I. SCHWARTZBACH |
|