0

I have implemented jsf form based authentication like the following:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets">
   <h:head>
     <div>My Application</div>
   </h:head>
   <h:body>
      <form name="loginForm" method="POST" action="j_security_check">
        <table>
          <tr>
            <td  align="right"><strong>User name</strong></td>
            <td><input type="text" name="j_username"/></td>
          </tr>
          <tr>
            <td align="right"><strong>Password</strong></td>
            <td><input type="password" size="25" name="j_password"/></td>
          </tr>
          <tr>
          <td/><td/>
          </tr>
          <tr>
             <td/>
             <td><input type="submit" value="Submit"/></td>
          </tr>
        </table>
      </form>
   </h:body>    
</html>

and it works fine. But when I'm tring to make labels to not be hard-coded but get loaded from resource bundle like this:

instead of this:

<td align="right"><strong>Password</strong></td>

having this:

<td align="right"><strong>#{uiBundle['password']}</strong></td>

it doesn't load the expected label. Note, it work's fine for all my other pages. I have registered the resource bundle in faces-config like the following:

  <resource-bundle>
    <base-name>bundles.UiBundle</base-name>
    <var>uiBundle</var>
   </resource-bundle>

Also, I tried to load it loaccaly by adding:

 <f:loadBundle basename="bundles.UiBundle" var="uiBundle"/>

but it also didn't help. I wonder why it doesn't work for login page and what is the way for having label translations in login page.

Thanks in advance.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
sergeyan
  • 1,173
  • 1
  • 14
  • 28
  • 2
    do a view-source of the page in the browser... what do you see? an `h:head` and `#{uiBundle['password']}`? – Kukeltje Feb 26 '16 at 13:06
  • Indeed, sounds too much like request simply didn't hit FacesServlet at all. And, please don't add version tags for sake of attention. You added both [jsf-1.2] and [jsf-2.2] in a single question which just doesn't make sense. – BalusC Feb 26 '16 at 13:24
  • Not, sure what you mean, but in page source I see exactly the same source code I have (see in the question). – sergeyan Feb 26 '16 at 13:25
  • 1
    Okay, as we guessed. The FacesServlet is simply not invoked. See duplicate for the answer. It's just a matter of getting its URL pattern right. – BalusC Feb 26 '16 at 13:25
  • 1
    Right, accidentally I had wrong url-pattern. Thanks. – sergeyan Feb 26 '16 at 14:40

0 Answers0