P
P
P_Alexander2018-01-18 15:24:52
Java
P_Alexander, 2018-01-18 15:24:52

How, after user registration, to display on the same JSP page the answer that the required fields are not filled?

There is a jsp page where registration takes place, when registering, if the user has not filled in all the fields and clicked on the register button, then a line should be displayed under the field that he did not fill out that notifies him that the field must be filled!
That is, I accept everything that he entered in the POST method in the servlet, process it and must again output the processing response to the same jsp! How do I do this using EL(JSTL)
How do I do this, I created an error class that in the POST method receives all fields from jsp, then checks them for emptiness and if it is empty, then puts it in hashMap (field name, error message) then I you need to pull out a warning message from the HashMap by the key in the same jsp, under a specific field!
Still interested in what manipulations need to be done in the servlet itself to achieve this?
Am I doing the right thing or is there a better way?
I can send the code if needed.
Who can explain or skinte articles in which the same is done, Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Roo, 2018-01-18
@P_Alexander

Form processing is best done in JS - on the user's side. But when everything is tip-top with the form (well, at least on formal grounds) - then send it to the server.

Y
Yerlan Ibraev, 2018-01-19
@mad_nazgul

With jsp it's more difficult, with jsf it's easier.
Google about form validation.
@Validate, @NotNull etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question