P
P
P_Alexander2018-01-11 12:21:56
Java
P_Alexander, 2018-01-11 12:21:56

How to properly organize the filter structure?

Hello, I am writing my first web app, this is a site for car sales.
There is currently a main page, a registration page and an entry page, + there is a connection pool, now I want to add filters, I read for them what they should do but I can’t figure out how to build the correct structure for them, I want to learn how to write right away!
For example Where should it be checked if such an already registered user is in the filter or on the servlet, who should watch for empty js fields or in the filter or on the servlet to watch this ??
Still Where should the session be created immediately or when the user logged into his account (logged in) ???
You also need a filter that should not let you into your personal account if you are not logged in, that is, what else would he look for so that the path is not registered to the page with your personal account
If you have any thoughts or good examples of this write me I need any help!
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Kopendakov, 2018-01-12
@P_Alexander

After clicking "Login", the first check is with the servlet, it should remember you in the user's session.
And then - the filter should already check that within the current session the user has already "introduced himself", and let him go where he is breaking, (but only if it is possible for him according to the access level)
The task of the filter is just not to let him into his personal account logged in user.
For understanding, it helped me a lot - https://github.com/proton2/ServletJdbcExample
Also, boostbrain on YouTube, in a series of webinars, about filtering is well chewed (filtering in the last 3, it seems.)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question