sunwenyue
sunwenyue
2019-05-03 12:02

哪位大佬知道我点击邮箱里的激活邮件链接页面显示空白

  • java
  • tomcat
  • maven

//3.激活邮件,邮件正文?
String content = "点击激活【报警信息系统】";
MailUtils.sendMail(user.getEmail(),content,"激活邮件");

@WebServlet("/activeUserServlet")
public class ActiveUserServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//1.获取激活码
String code = request.getParameter("code");
if (code != null){
//2.调用service完成激活
UserService service = new UserServiceImpl();
boolean flag = service.active(code);
//3.判断标记
String msg = null;
if (flag){
//激活成功
msg = "激活成功,请登录";
}else {
//激活失败
msg = "激活失败,请联系管理员!";
}
response.setContentType("text/html;charset=utf-8");
response.getWriter().write(msg);
}
}

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

}

}

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答