A
A
Alexander Nikolaev2020-11-14 11:52:39
HTML
Alexander Nikolaev, 2020-11-14 11:52:39

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

2 answer(s)
D
Dima Polos, 2020-11-14
@dimovich85

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.

M
Maxim, 2020-11-14
@max_shane

You will figure out how to make an XMLHttpRequest in 15 minutes maximum. If you have mastered Java...
But there you can already send blob-objects and json.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question