This week's book giveaway is in the Testing forum.
We're giving away four copies of The Way of the Web Tester: A Beginner's Guide to Automating Tests and have Jonathan Rasmusson on-line!
See this thread for details.
Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaMail - Reopening a pop3 folder

Bill Ostaski
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I setup a webmail webapp a year or so ago using the javamail example and now decided to add support for browsers w/o cookies enabled by using response.encodeURL(). Also moving the webapp from tomcat3.2.something to tomcat4.1.24.
Now I've stumbled across a problem with my DeleteMessageServlet - it just sets the deleted flag on a message (mailuser.setDeletedFlag(msg) and brings you back to messageheaders.jsp. For some reason, when it now returns to messageheaders.jsp, I get an indexoutofbounds exception because the number of messages w/o the deleted flag set has changed.
So I tried forwarding to DeleteMessage.jsp after setting the delete flag in DeleteMessageServlet. Here's DeleteMessage.jsp:
***** DeleteMessage.jsp *****
<%@ page errorPage="errorpage.jsp" %>
<%@ page language="java" import="com.cove.webmail.MailUserBean, javax.mail.*" %>
<jsp:useBean id="mailuser" class="com.cove.webmail.MailUserBean" scope="session" />
<title>Delete Message</title>
<body bgcolor="white">
<h3><i><%= request.getParameter("Subject") %></i></h3>
<p>will be deleted when you Logout.</p>
<% mailuser.getFolder().close(true); %>
<% if (mailuser.isLoggedIn()) { %>
<%= mailuser.getUsername() %> is still logged in.
<% } %>
<% if (mailuser.getStore() != null) { %>
<%= mailuser.getUsername() %> has store.
<% } %>
<% mailuser.getStore().getFolder("INBOX").open(Folder.READ_WRITE); %>
<% if (mailuser.getFolder().isOpen()) { %>
folder is now open.
<% } %>
***** End DeleteMessage.jsp *****
As you can see, I tried to close the folder - which should expunge the message - and then try to reopen the folder. The jsp compiles OK, I see the "user is still logged in" and "user has store," but can't seem to get the "folder is now open" to work.
Also tried to do all this through methods in MailUserBean and others. It's been three days of mind-numbing madness...
Any clues?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic