The password tag

Ads
 

The password tag

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

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>


Ads

Ads