www.pudn.com > JMail4Email.rar > ViewMessageListAction.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 ViewMessageListAction implements Action {
public ViewMessageListAction() {
}
/**
* Performs the following steps...
*
* - ....
*
*
* The data is then placed in the user's session. The attribute is named
* Constants.DATA
*/
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
Message[] msgs = MailHelper.getMessages(mailSession, theUserInfo);
// place the messages in the http session
theHttpSession.setAttribute(Constants.MESSAGE_LIST, msgs);
}
catch (Exception exc) {
exc.printStackTrace();
throw new ActionException(exc.getMessage());
}
}
}