Javatpoint Logo
Javatpoint Logo

Authentication Filter

We can perform authentication in filter. Here, we are going to check to password given by the user in filter class, if given password is admin, it will forward the request to the WelcomeAdmin servlet otherwise it will display error message.

Example of authenticating user using filter

Let's see the simple example of authenticating user using filter.

Here, we have created 4 files:
  • index.html
  • MyFilter.java
  • AdminServlet.java
  • web.xml
index.html

MyFilter.java

AdminServlet.java

web.xml
Next TopicFilter Config





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA