Java Tip: Spice Up Your GlassFish Authentication Form
Usually when you develop a GlassFish-based authentication form, you assume that the action should be j_security_check and the fields are j_username and j_password. Knowing that, you can write an HTML form like this:
<form method="POST" action="j_security_check">
Username: <input type="text" name="j_username" />
Password: <input type="password" name="j_password" />
<input type="submit" value="Login" />
</form>
You can spice up this form using JSF code like this:
<form method="POST" action="j_security_check">
<h:outputLabel for="j_username">Username:</h:outputLabel>
<h:inputText id="j_username" required="true" />
<h:message for="j_username" />
<h:outputLabel for="j_password">Password:</h:outputLabel>
<h:inputSecret id="j_password" required="true" />
<h:message for="j_password" />
<h:commandButton value="Login" />
</form>
Or, you can take advantage of cool PrimeFaces themes by writing the form like this:
<form method="POST" action="j_security_check">
<h:outputLabel for="j_username">Username:</h:outputLabel>
<p:inputText id="j_username" required="true" value="" />
<h:outputLabel for="j_password">Password:</h:outputLabel>
<p:password id="j_password" required="true" value="" feedback="false" minLength="0" />
<h:commandButton value="Login" type="submit" />
</form>
0 Comments (click to add your comment)
Networking Solutions



Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.