title: How can I modify the login page based on the target URL with JavaServer Faces?
body: <p>In my JSF 2 I use form based authentication. The web.xml contains a single login.html entry.</p>
  
  <pre><code>&lt;login-config&gt;
      &lt;auth-method&gt;FORM&lt;/auth-method&gt;
      &lt;realm-name&gt;testDB&lt;/realm-name&gt;
      &lt;form-login-config&gt;
          &lt;form-login-page&gt;/login.html&lt;/form-login-page&gt;
          &lt;form-error-page&gt;/loginError.html&lt;/form-error-page&gt;
      &lt;/form-login-config&gt;
  &lt;/login-config&gt;
  </code></pre>
  
  <p>The web app has a main page (/app/index.html) and a /app/mobile/index.html to support mobile phones.</p>
  
  <p>I would like to use different layouts in login.html, based on the target URL.</p>
  
  <ul>
  <li><p>if the target URL is /app/mobile/index.html, use a login page which is optimized for small browser sizes</p></li>
  <li><p>otherwise use the default login page</p></li>
  </ul>
  
  <p>The login page (login.html) page is a JSF page.</p>
  
  <p>Is it possible to get the 'destination' page within the login page with JSF, maybe using information in the FacesContext?</p>