Share on Google+Share on Google+

The password tag

Advertisement
In this section, you will learn about the password tag of the Spring form tag library.

The password tag

In this section, you will learn about the password tag of the Spring form tag library.

The form tag provides an HTML 'input' tag with type 'password' using the bound value as given below :

<form:form>
	<table>
		<tr>
		<td>User Name:</td>
		<td><form:input path="userName" /></td>
		</tr>
		<tr>
		<td>Password:</td>
		<td><form:password path="password" /></td>
		</tr>
		<tr>
		<td colspan="2">
		<input type="submit" value="Login" />
		</td>
		</tr>
	</table>
</form:form>

As you can see that the <form: password> tag is used to define the password input field of the form.

By default, the password value is not shown by this tag. If you want to show password value, you can do this by setting the value of the 'showPassword' attribute to true. When you do it, you will get the rendered HTML code as shown below :

<form:form>
	<table>
		<tr>
		<td>User Name:</td>
		<td><form:input path="userName" /></td>
		</tr>
		<tr>
		<td>Password:</td>
		<td><form:password path="password" value="^59690krBDc" showPassword="true" /></td>
		</tr>
		<tr>
		<td colspan="2">
		<input type="submit" value="Login" />
		</td>
		</tr>
	</table>
</form:form>


Advertisements

Advertisement

Posted on: January 14, 2013 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: The password tag  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0