Alex
Alex

Reputation: 617

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

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.

Upvotes: 0

Views: 227

Answers (1)

Fernando Lozano
Fernando Lozano

Reputation: 392

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

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

I hope it helps.

Upvotes: 1

Related Questions