Validating username and password in servlet

From the servlet make one requestdispatcher object and call forward method which pass your request to jsp and display it. Our Simple Java class which contains variable declaration and getter and setter method with no argument constructor that is our POJO class.Generally MVC model flow like Jsp -- Hi, POJO means Plain Old Java Object. Hi Nitin, If you want to suggestion for business logic then use same way as Ankit Garg says.When a user submits their name and password, the server determines if the user name and password are those of an authorized user and, if authorized, sends the requested web resource.In general, the steps are necessary for adding form-based authentication to an unsecured servlet are similar to those described in Example: Basic Authentication with a Servlet, so just follow all of the steps in Example: Basic Authentication with a Servlet, except use the deployment descriptor described in Specifying Security in the Deployment Descriptor instead and create the login form and login error form pages as described in Creating the Login Form and the Error Page.This has been deprecated since JSF 2.0 in favor of Facelets. programming forums Java Java JSRs Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Products This Site Careers Other all forums Hello, I have a JSP Registration page where the user inserts the username,password,address etc into the database. But make another POJO Class for your business logic.Make object of that class and call method which contains all your business logic.

Then don't use HTML code in your Servlet make one separate jsp which contains basically your view part.All security for this example is declared in the deployment descriptor for the application.A security constraint is defined in the deployment descriptor that tells the server to send a login form to collect user data, verify that the user is authorized to access the application, and, if so, display the JSP page to the user.The completed version of this example application can be found in the directory .