I created sample spring MVC program to display the student name, id and age. I want to restrict entering of numbers in the textfield and string in place for age. Also I want to make the id field mandatory. I am using JSP for the view.
I had searched a lot but cannot find a suitable solution I am expecting your help, Thanks in advance. This is the jsp file
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<html>
<head>
<title>Spring MVC Form Handling</title>
</head>
<body>
<h2>Student Information</h2>
<form:form method="POST" action="addstudent">
<table>
<tr>
<td><form:label path="name" id="tct" >Name</form:label></td>
<td><form:input path="name" /></td>
</tr>
<tr>
<td><form:label path="age">Age</form:label></td>
<td><form:input path="age" /></td>
</tr>
<tr>
<td><form:label path="id">id</form:label> </td>
<td><form:input path="id" /></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="Submit"/>
</td>
</tr>
</table>
</form:form>
This were the search result i have found
restrict a character to type in a text box
Restricting input to textbox: allowing only numbers and decimal point
if this link works please help me to integrate it with my JSP file.I am beginner in javascript and HTML.
Thanks in advance