Howdy,
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" />
<html>
<head>
<title>Delete Message</title>
</head>
<body bgcolor="white">
<p><br><br></p>
<center>
<h3><i><%= request.getParameter("Subject") %></i></h3>
<p>will be deleted when you Logout.</p>
</center>
<% mailuser.getFolder().close(true); %>
<% if (mailuser.isLoggedIn()) { %>
<%= mailuser.getUsername() %> is still logged in.
<% } %>
<br>
<% if (mailuser.getStore() != null) { %>
<%= mailuser.getUsername() %> has store.
<% } %>
<br>
<% mailuser.getStore().getFolder("INBOX").open(Folder.READ_WRITE); %>
<br>
<% if (mailuser.getFolder().isOpen()) { %>
folder is now open.
<% } %>
</body>
</html>
***** 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?
Thanks!