Exemple #1
0
 public static ActionForward sendEmail(
     HttpServletRequest request, Sender sender, Recipient... recipient) {
   EmailBean emailBean = new EmailBean();
   if (recipient != null) {
     emailBean.setRecipients(Arrays.asList(recipient));
   }
   if (sender != null) {
     emailBean.setSender(sender);
   }
   request.setAttribute("emailBean", emailBean);
   return FORWARD_TO_NEW_EMAIL;
 }
Exemple #2
0
  @EntryPoint
  public ActionForward newEmail(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response) {
    EmailBean emailBean = getRenderedObject("emailBean");

    if (emailBean == null) {
      emailBean = (EmailBean) request.getAttribute("emailBean");
    }

    if (emailBean == null) {
      emailBean = new EmailBean();
      final Set<Sender> availableSenders = Sender.getAvailableSenders();
      if (availableSenders.size() == 1) {
        emailBean.setSender(availableSenders.iterator().next());
      }
    }
    RenderUtils.invalidateViewState();
    request.setAttribute("emailBean", emailBean);
    return mapping.findForward("new.email");
  }