I am working on Spring mvc and also new in this concept. I have a dropdown using unordered list and I want to get the data from the dropdown in Controller when i click the submitt button. I also have text field, which is very easy to get the test field into contoller using. but i dont know how to get the data from the drop down list. my jsp page is like this I have implemented html code like this
<form role="form" method="post" action="/Web/password.html">
<fieldset>
<div class="form-group input-group">
<span class="input-group-addon">
<i class="glyphicon glyphicon-user"></i>
</span>
<input class="form-control" placeholder="User Name" name="userName" type="email" required="" autofocus="">
</div>
<div class="form-group input-group">
<span class="input-group-addon">Applications</i></span>
<div class="btn-group" id='btnn'>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span data-bind="label">Select One Application</span> <span class="caret"></span>
</button>
<ul class="dropdown-menu" name="dropDown" role="menu" style="height:200px;overflow: auto;" >
<c:forEach var ="entry" items="${listOfApp }">
<li><a tabindex="-1" href=""><c:out value="${entry }" /></a></li>
</c:forEach>
</ul>
</div>
</div>
</fieldset>
</form>
and my controller is
@RequestMapping(value = "/password.html", method = RequestMethod.POST)
public String submit(@RequestParam (value ="userName") String userName,
@RequestParam ("dropDown") String dropDown) {
System.out.println(dropDown+" "+userName);
return "Hi";
}
I have used <li> as text field in controller. but on server it is showing error that it not getting the value from name 'dropdown'. If someone knows how to solve this then please help me.