Java Reference
In-Depth Information
<hr><a href # "logout.jsp">Logout </a> .
<hr><i> UbiMail - Ubiquitous e-mail system </i>
</body></html>
The JSP message.jsp displays the contents of a message, which is identified
by the parameter index that is provided by mail.jsp . The body of the email
message can be in different formats: in the most common case it is a string,
otherwise it is formatted as a multipart content. If it is multipart, each of the
parts must be shown. For the sake of simplicity in this prototype we decided
to show only the textual parts (either plain text or HTML) and to provide the
indication of the MIME type of the remaining parts.
<%@ page contentType # "text/html" language # "java" %>
<%@ page import # "javax.mail.*, javax.mail.internet.
InternetAddress" %>
<%
if (session.isNew()){
response.sendRedirect("index.html");
return ;
}
String user # (String) session.getAttribute("user");
Folder folder # (Folder) session.getAttribute("folder");
int index # Integer.parseInt((String)request.
getParameter("index"));
%>
<html><head><title> UbiMail -
<% # user %> 's mailbox </title></head>
<body>
...
<h2> Message # <% # index %></h2>
<%try {
Message msg # folder.getMessage(index);
InternetAddress addr # (InternetAddress)msg.getFrom()[0];
%>
<table border # 1 width # "100%" >
<tr><td bgcolor # "#FFE0E0" > Subject
<td bgcolor # "#E0E0FF" ><% # msg.getSubject() %>
<tr><td bgcolor # "#FFE0E0" > From <td bgcolor # "#E0E0FF" >
<tt><a href # "mailto: <% # addr.getAddress() %> " >
<% # addr.getPersonal() %>
&lt; <% # addr.getAddress() %> &gt; </tt>
<tr><td bgcolor # "#FFE0E0" > Date
<td bgcolor # "#E0E0FF" ><% # msg.getSentDate() %>
<%
Object content # msg.getContent();
if ( content instanceof String){
%>
Search WWH ::




Custom Search