title: How to redirect to an anchor in JSF?
body: <p>Let's say I have this action in a JSF Managed Bean:</p>
  
  <pre><code>public String doSomething() {
      FacesContext.getCurrentInstance().getExternalContext().getFlash().put("msg", "Something was done successfully");
      return "view?faces-redirect=true";
  }
  </code></pre>
  
  <p>My <code>view</code> has an anchor element with the id <code>msg</code>. I want the url to have this anchor (for accessibility matters), like:</p>
  
  <pre><code>view.jsf#msg
  </code></pre>
  
  <p>Or whatever is my FacesServlet filter pattern.</p>
  
  <p><code>return "view#msg?faces-redirect=true";</code> obviously will not work because JSF (mojarra at least) will try to evaluate <code>view#msg</code> as a view.</p>
  
  <p>So my question is how to make JSF redirect to a URL with <code>#msg</code> in the end.</p>