Validating username and password in servlet

This will help us make our code generic for using with other JDBC drivers and with other databases.

Ofcourse, this is just a step to make the code database independent.

However, it should hide the technical issues to prevent panic amongst the end user.Pre-requisites• My SQL and Tomcat is already installed• You have basic knowledge of My SQL to create tables and insert / update records.• You have basic knowledge of Java and J2EE web applications.• Have your favorite IDE for developing / reviewing code.Concepts Covered• JDBC connectivity to My SQL from Servlet• Simple application of JSTL tag• Using session variable in Servlet• Polymorphism concept using JDBC• Basic error handling concepts Analysis and Design The application is pretty straightforward and it is not too hard to design.We have maintained the queries, passwords as static variables in the Servlet as it will not change.

Ideally, they should be taken from some properties or XML file. But over here we are taking static values of username and is if the username is dolly and if the password is dolly it is valid else it is not.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>