Java Reference
In-Depth Information
«jsp»
Login
«html»
index
«link»
javax.mail
«link»
«jsp»
Logout
«jsp»
Main
«jsp»
Message
«link»
«link»
«link»
Figure 16.5 Design of the basic access system
16.3.3
Implementation
The initial page is a static HTML page, index.html ; it contains a form to input
the name of the user. The form data is submitted to the JSP login.jsp .
<html><head><title> Ubi Mail Login </title></head>
<body><h1> UbiMail </h1>
Ubiquitous E-Mail System
<p><hr>
<table>
<tr><td align # "center" >
<form method # "POST" action # "login.jsp" >
User: <input type # text name # "login" size # "15"/ >
<br><input type # submit value # "Login" >
</form>
</td></tr>
</table>
<hr>
<i> Your email everywhere! </i>
</body></html>
The first JSP of the system, login.jsp , takes the information about the user
and asks for the parameters to connect to the mail server. It gets the value of
the data login entered in the index page and stores it in the session attribute
user . The session contains all the information shared by the JSPs that make
up the application; in this case the information consists of the username and
the objects that represent the mail server.
<%@ page contentType # "text/html" language # "java" %>
<%
String user # request.getParameter("login");
session.setAttribute("user",user);
%>
 
 
Search WWH ::




Custom Search