dimanche 22 février 2015

Propogating List of an object from JSP to Controller - Spring

I have a form variable like,



private List<KeyItemDto> taxList;


in taxListItemsBean.java


I am using this in JSP as follows:



<form:select id="taxId" path="taxSeqNo" cssClass="defaultText" <form:options items="${taxListItemsBean.taxList}" itemValue="key" itemLabel="label"/>
</form:select>


I want to pass this taxList back to controller thru Ajax



//...
var taxdropdown = $("#taxId");
var options = {
url: "${pageContext.request.contextPath}/abc.html",
dataType : 'json',
data: JSON.stringify(taxdropdown),
...//


Controller code:



@RequestMapping(value = "/abc.html", method = RequestMethod.POST)
public ModelAndView executeTaxtInternal(HttpServletRequest request,
@RequestBody List<KeyItemDto> taxdropdown) {
// I want to get taxdropdown and iterate the list here
}

Aucun commentaire:

Enregistrer un commentaire