First Jsp Servlet Example-Login Page

Step1:create Dynamic Web Project.

File->new->Dynamic Web Project.

Step2:Create package com.controller

create controller LoginController.

There are two methods by defalut in servlet .doGet and doPost

doGet()-This method is used when you just need to give user some information.example:list of students who passed.

doPost()-This method is used when you need to pass some information from JSP to SERVLET.

example:sign up or login form where you enter something in textbox and hit submit button.

Step3:Create Jsp page named login.jsp under folder Webcontent

action=”login” implies the values in textbox userName and passWord should be passed to the servlet with nickname “login”.

Next tutorial will teach you how to insert values in database using Jsp and servlet.jsp servlet example with database connection

Leave a Reply

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