黑马程序员技术交流社区
标题:
servlet无法实现转发
[打印本页]
作者:
王怀亮
时间:
2013-4-19 19:26
标题:
servlet无法实现转发
在进行转发时,提示无法实现转发,是什么原因呢,下面是部分代码:
Address from = new InternetAddress(myEmail);
Address to = new InternetAddress(Email);
MimeMessage msg = new MimeMessage(session);
msg.setFrom(from);
msg.setSubject("xxxxxxx报名系统");
msg.setSentDate(new Date());
msg.setContent("您已报名成功\n请点击<A href='" + url + "'>" + url
+ "</A>完成注册", "text/html;charset=utf-8");
msg.setRecipient(RecipientType.TO, to);
/*
* Transport transport = session.getTransport("smtp");
* transport.connect("smtp.163.com", userName, password);
* transport.sendMessage(msg,msg.getAllRecipients());
* transport.close();
*/
Transport.send(msg);
} catch (Exception e) {
e.printStackTrace();
}
request.getRequestDispatcher("/sendMailSuccess.jsp").forward(request,
response);
复制代码
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2