Spring form in JSP:
jQuery 代码:
java代码:
command is CommandName attribute in spring form.
CommandName Is the name of an Object in the request scope or session scope that contains the information about the form(HTML Form).It is used as a backing object for any form.When we associate a model object with ModelAndView, it could be used to associate the JAVA object to the HTML input tags using the path attribute.i.e in simple terms the request parameters get bound to the class associated with the commandName.
<form:form method="POST" commandName="command" action="navigateFolderReports.action" class=" clearfix form-horizontal" >
jQuery 代码:
function navigateGeneratedReports(reportParentFolderId){
$("#reportParentFolderId").remove();
$("#command").attr("action", "navigateReport.action");
$("#command").append($('<input>', {
'type':'hidden',
'id' : 'reportParentFolderId',
'name' : 'reportParentFolderId',
'value' : reportParentFolderId
}));
$("#command").submit();
}
java代码:
String reportParentFolderId = request.getParameter("reportParentFolderId");
command is CommandName attribute in spring form.
CommandName Is the name of an Object in the request scope or session scope that contains the information about the form(HTML Form).It is used as a backing object for any form.When we associate a model object with ModelAndView, it could be used to associate the JAVA object to the HTML input tags using the path attribute.i.e in simple terms the request parameters get bound to the class associated with the commandName.