Answer the question
In order to leave comments, you need to log in
How to make http requests through html forms?
I am writing a web service in Java (Spring). It is necessary to make a POST request by clicking on the button in the form, but at the same time pass the content of the form text field as an argument. Can this be done with standard HTML tools, or do I need to resort to other tools like JS and/or template engines like thymeleaf? Soryan if the question is stupid, I don’t rummage for the front very much.
Answer the question
In order to leave comments, you need to log in
In the form tag, fill in the action attribute - the url where the request should be sent. Add the method="POST" attribute to the form tag. Inputs must have name attributes. Everything, as it were, no JS. Keep in mind - there will be a page reload and the back should give something to the client or make a redirect.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question