📄 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...
* <ol>
* <li>....</li>
* </ol>
*
* The data is then placed in the user's session. The attribute is named
* <code>Constants.DATA</code>
*/
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());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -