title: Show FacesMessage and reload Page in JSF
body: <p>I am sending Emails From a JSF Application. I need it Such That When I Send the Email, a FacesMessage is Displayed Confirming the Action and the Browser reloads to the Same Page. The code I have Shows the Face but does Not reload the same page.</p>
  
  <pre><code>public String sendEmail(){
  //Email Sending Code.....
   Transport.send(message);
  
              FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,
                      "Successfull\n", "You have successfully sent an e-mail to : " + e_mail + ". \n Thank You"));
  
              return "Email?redirect-true";
  }
  </code></pre>
  
  <p>This is What I Have tried, this code Reloads the Page But the FacesMessage is Not Shown.</p>
  
  <pre><code>public String sendEmail(){
      //Email Sending Code.....
       Transport.send(message);
  
                  FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,
                          "Successfull\n", "You have successfully sent an e-mail to : " + e_mail + ". \n Thank You"));
                   FacesContext context = FacesContext.getCurrentInstance();
              HttpServletRequest origRequest = (HttpServletRequest) context.getExternalContext().getRequest();
              String contextPath = origRequest.getContextPath();
              FacesContext.getCurrentInstance().getExternalContext().redirect(contextPath + "/faces/Email.xhtml");
                  return "Email?redirect-true";
      }
  </code></pre>
  
  <p>And Here Is My Code for the Send Email Page:</p>
  
  <pre><code>    &lt;h:form &gt;
              &lt;p:growl id="growl" showDetail="true"/&gt;
              &lt;p:panel header="Send Email" style=" width: 70%"&gt;
                  &lt;h:panelGrid columns="2"&gt; 
                      &lt;h:outputLabel value="E Mail Address: " /&gt;
                      &lt;h:inputText value="#{mailing.e_mail}" style="width: 400px"/&gt;
  
                      &lt;h:outputText value="Subject: " /&gt; 
                      &lt;h:inputText value="#{mailing.subject}" style="width: 400px"/&gt;
  
                      &lt;h:outputText value="Message: " /&gt;
                      &lt;h:inputTextarea value="#{mailing.mess}" style="height: 300px;width: 700px"/&gt;
                      &lt;h:panelGroup/&gt;
                      &lt;p:commandButton
                          value="Send Mail "
                          action="#{mailing.sendEmail()}"
                          ajax="false"/&gt;
                  &lt;/h:panelGrid&gt; 
              &lt;/p:panel&gt;
          &lt;/h:form&gt;
  </code></pre>
  
  <p>Please help</p>