So my Spring MVC project home page has two input fields within a form.
The user can enter the roll number or name.
Jsp
<form action="search" method="GET" >
<div style="text-align: center;">
<input type="text" id="regNo" name="regNo" size="30" maxLength="50" "></input> or
<input id="studentName" type="text" size="30" maxLength="50" "></input>
</form>
In my controller, I have two methods mapped to two input fields.
@RequestMapping(value ="/search", method = RequestMethod.GET)
public String getStudent(String regNo, ModelMap model){
return "A";
}
@RequestMapping(value="/search", method = RequestMethod.GET)
public String searchStudentByName(String studentName, ModelMap model){
return "B";
}
Since both the input fields are String, I don't know how can I map them to two different methods in controller?