title: Hit a bean method and redirect on a GET request
body: <p>I'm using JSF 2 and PrimeFaces 2.1 on GlassFish.</p>
  
  <p>I have a page that is intended to allow people to perform an action after following a callback URL (e.g. as link embedded in email or as callback URL parameter of some external authentication or payment service). In my case I need to reset the password. The callback URL has a <code>token</code> GET parameter like so:</p>
  
  <pre>http://example.com/app/resetPasswordForm.jsf?token=abc123</pre>
  
  <p>On page load of <code>resetPasswordForm.jsf</code>, I need to check if the token is valid and redirect to the main app screen if it's not valid.</p>
  
  <p>My thinking is to have a bean method like:</p>
  
  <pre><code>public String resetPasswordHandler.showResetForm(String token) {
    if /* token is valid */ {
      return "resetPasswordForm.jsf";
    } else {
      return "main.jsf";
    }
  }
  </code></pre>
  
  <p>But how would I cause that method to get hit on page load?</p>
  
  <p>Not sure how to proceed -- suggestions are welcome.</p>