www.pudn.com > JMail4Email.rar > ViewMessageDetailAction.java
package ezmail;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.mail.Session;
import javax.mail.Folder;
import javax.mail.Message;
public class ViewMessageDetailAction implements Action {
public ViewMessageDetailAction() {
}
/**
* Performs the following steps...
*
* - ....
*
*
*/
public void perform(ServletContext servletContext,
HttpServletRequest request,
HttpServletResponse response) throws ActionException {
try {
HttpSession theHttpSession = request.getSession();
// retrieve the mail session
Session mailSession = (Session) theHttpSession.getAttribute(Constants.MAIL_SESSION);
UserInfo theUserInfo = (UserInfo) theHttpSession.getAttribute(Constants.USER_INFO);
// retrieve the messages from the user's inbox
int messageNum = Integer.parseInt(request.getParameter("message_num"));
Message theMsg= MailHelper.getMessage(mailSession, theUserInfo, messageNum);
// place the messages in the http session
theHttpSession.setAttribute(Constants.CURRENT_MESSAGE, theMsg);
}
catch (Exception exc) {
exc.printStackTrace();
throw new ActionException(exc.getMessage());
}
}
}