stash
stash

Reputation: 47

Java Spark Thymeleaf

How can I take a variable value from html file? Example: <input type="text" value="name"> And I'd like to take this value from this input type text to my Controller which needs it to create an object ?

I use Java Spark and thymeleaf

Upvotes: 0

Views: 554

Answers (1)

tipsy
tipsy

Reputation: 402

You need to put your input element in a form and add a submit button. Once you're sure the form is sending information to the server you can access the parameter in Spark using request.queryParams("name");

More on Spark's Request: http://sparkjava.com/documentation#request

Upvotes: 0

Related Questions