Issue in form submit with the Integration of HDIV and Spring MVC

229 views Asked by At

I integrated HDIV and Spring MVC. Now I need to submit a form to the server. The problem is I need to give the submit button a name like "btnSave" or "btnSubmit". So that I can make request mapping like this

@RequestMapping(value = "/user", params = "btnSave", method = RequestMethod.POST)

and I render the submit button like this:

<input name="btnSave" type="submit" value="Save" />

Now HDIV will gives the error message: INVALID_PARAMETER_NAME about btnSave.

I know I can exclude paramter btnSave in the HDIV configuration, but I am just wondering if there is any better solution. I have a lot of forms with different submit buttons on them and I dont want to put all of them into the HDIV configuration of paramsWithoutValidation.

Thanks.

1

There are 1 answers

0
Fernando Lozano On BEST ANSWER

You have to use Spring MVC's tag for submit.

<form:button value="Save" name="btnSave">Save</form:button>

I hope it helps.