Tchorson
Tchorson

Reputation: 33

In Thymeleaf, how to acquire HTML variable and send it to controller?

I have no idea how to retrieve image's name.

Required String parameter 'image.name' is not present. This is what I get after clicking on the button.

Controller's method

Page from that I'm trying to get image's name

What should I change to get this variable?

Upvotes: 1

Views: 131

Answers (1)

Afaq Ahmed Khan
Afaq Ahmed Khan

Reputation: 2302

You have not provided name attribute in your output field, if you could set it to be like this it would know that you are referring to this field with name "image.name"

<input type="hidden" th:field="${image.name}" name="image.name">

Upvotes: 4

Related Questions