Implementing a logon form with JSF has been alwys a bit troublesome. This requires form input elements with input names j_username and j_password. With the JSF RI this is hard to accomplish. So you typically end up with including the Apache MyFaces Tomahawk components which offer a forceId attribute.

1
2
3
4
<h:outputText value="User" />
<t:inputText id="j_username" forceId="true"/>
<h:outputText value="Password" />
<t:inputSecret id="j_password" forceId="true" />

If you are using other popular JSF component libraries, things might get a bit more handy (you can avoid including tomahawk just for fully controlling the input ids!).

With Myfaces Trinidad (Oracle ADF Faces) it is pretty easy, ids are accepted as they are:

1
2
3
4
<tr:outputLabel value="User" />
<tr:inputText id="j_username" />
<tr:outputLabel value="Password" />
<tr:inputText id="j_password" secret="true" />

With JBoss Rich-Faces use the a4j:form tag:

1
2
3
4
5
6
<a4j:form prependId="false">
  <h:outputText value="User" />
  <h:inputText id="j_username" />
  <h:outputText value="Password" />
  <h:inputSecret id="j_password" />
</a4j:form>

Comments