Answer the question
In order to leave comments, you need to log in
Interaction between forms and servlet?
Good afternoon!
Suppose there are several forms on the page with different number of parameters. Does each form need its own servlet, or can it be "styled" all in one?
I will be grateful!
Answer the question
In order to leave comments, you need to log in
It would be more correct, of course, to arrange everything in one :)
According to the model-view-controller approach (one of the main web application design patterns ), such a servlet will be a controller . A single entry point makes it easy to control access to the application, pre-process the request, and route it to the right handlers.
This applies not only to the described case of a page with several forms, but also to the application as a whole. In particular, this is how the Spring and Struts frameworks work.
It would be more correct, of course, for each form to have its own servlet.
If in one, then you will have to get, say, one field from each form and check if they exist. And by this to understand from what form the request came. But in my opinion, this is a very clumsy performance.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question