login and registration form using servlet and authentication through mysql

login and registration form using servlet and authentication through mysql

i made a simple login and rgistration form using servlet and authentication through mysql and whenevr i run it on tomcat a blank page is displayed plz help here is my code...plz chk the web.xml file also

index.jsp(login form)

<%@page contentType="text/html" pageEncoding="UTF-8"%> :::LOGIN:::

Enter the Username:
Enter the Password:
Register here

login.java (servlet)

package login;

import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement;

import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;

public class login extends HttpServlet {

private static final long serialVersionUID = 1L;

public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    System.out.println("test");
    String driver = "com.mysql.jdbc.Driver";
    String url = "jdbc:mysql://localhost/login";
    response.setContentType("text/html");
    String msg = " ";

    String username = request.getParameter("username");
    String password = request.getParameter("password");
    try {
        Class.forName("com.mysql.jdbc.Driver");

        Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/login","root","");  

        String strQuery = "select * from validate WHERE username='"
                + username + "' and password='" + password + "'";
        Statement st = conn.createStatement();
        ResultSet rs = st.executeQuery(strQuery);
        if (rs.next()) {
            msg = "HELLO" + username + "! Your login is SUCESSFULL";

        } else {
            msg = "HELLO" + username + "!Your login is UNSUCESSFULL";
        }
        rs.close();
        st.close();
        System.out.println("test :" + msg);
        PrintWriter out = response.getWriter();
    } catch (Exception e) {
        e.printStackTrace();
    }

}

}

sign.jsp (signup form)

<%@page contentType="text/html" pageEncoding="UTF-8"%> :::Sign Up:::

Enter the Name:
Enter the City:
Enter the Country:
Enter the Username:
Enter the Password:
Login here

signup.java(servlet)

import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement;

import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;

public class signup extends HttpServlet {

private static final long serialVersionUID = 1L;

public void doGet(HttpServletRequest request, HttpServletResponse response)  
        throws ServletException, IOException {  
    System.out.println("test");

response.setContentType("text/html");
PrintWriter out = response.getWriter();

String n=request.getParameter("name");
String c=request.getParameter("city");
String co=request.getParameter("country");
String u=request.getParameter("username"); String p=request.getParameter("password");

try{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/login","root","");

PreparedStatement ps=con.prepareStatement("insert into registeruser values(?,?,?,?,?)");

ps.setString(1,n);
ps.setString(2,c);
ps.setString(3,co);
ps.setString(4,u);
ps.setString(5,p);

int i=ps.executeUpdate();
if(i>0)
out.print("You are successfully registered...");

System.out.println("test");
}catch (Exception e2) {System.out.println(e2);}

out.close();
}

}

web.xml

login index.html index.htm index.jsp default.html default.htm default.jsp login login login.login login /login signup signup signup signup /signup

View Answers









Related Tutorials/Questions & Answers:
login and registration form using servlet and authentication through mysql
login and registration form using servlet and authentication through mysql  i made a simple login and rgistration form using servlet and authentication through mysql and whenevr i run it on tomcat a blank page is displayed plz
How to Create Login/ Registration Form using PHP and MYSQL
How to Create Login/ Registration Form using PHP and MYSQL  Hi, I am learning PHP. I have some dilemma how to create a Login Form and make connectivity with HTML page using PHP and MYSQL. Is there any body can guide me
Advertisements
login authentication in jsp and servlet
it with complete code: Login Authentication using Bean and Servlet In JSP JSP... With Session Login Authentication using Bean and Servlet In JSP Thanks... to make login authentication in jsp and servlet? Thanks   Hi, I to make
Login form and registration
Login form and registration  I need a complete code for ligin and new user registration form and validation
how to connect the database using hibernet through servlet/jsp through form
how to connect the database using hibernet through servlet/jsp through form  plz give me the reply   Hi Friend, Please visit the following link:ADS_TO_REPLACE_1 http://www.roseindia.net/jsf/myfacesspring
Login & Registration - JSP-Servlet
Login & Registration  Pls tell how can create login and registration step by step in servlet. how can show user data in servlet and how can add and remove user only in servlet.   Hi Friend, Please visit
basic login and registration web page using jsp and servlet without using bean .....
basic login and registration web page using jsp and servlet without using bean .....  Hello Folks please i m totally beginner so guys please help me with very simple solution..... thnx
java code for registration and login pages, mysql as a bankend.
java code for registration and login pages, mysql as a bankend.  please send me the java code for registration and login pages and to store the data in mysql
servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ?
servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ?   first registration...; please help me for this i tried but when the press the registration button
servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ?
servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ?   first registration...; please help me for this i tried but when the press the registration button
servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ?
servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ?   first registration...; please help me for this i tried but when the press the registration button
servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ?
servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ?   first registration...; please help me for this i tried but when the press the registration button
servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ?
servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ?   first registration...; please help me for this i tried but when the press the registration button
servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ?
servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ?   first registration...; please help me for this i tried but when the press the registration button
servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ?
servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ?   first registration...; please help me for this i tried but when the press the registration button
how to login form through spring dao module
how to login form through spring dao module  here i want to chek user details in database through form by using spring dao module.please give me some reference example to me
registration form using oop concept
registration form using oop concept  I would like to write a program student registration form at kindergartens and display the information... the output?   Registration Form: import javax.swing.*; import java.awt.
Login authentication & mysql - Java Beginners
Authentication with MySql using Java Swing: 1)Create a java class...Login authentication & mysql  Hi , Could you guide or provide sample coding for the following scenerio. I need to code authentication for user
user Registration form using bean
user Registration form using bean   In this code,password and confirm password does n't matches.Every time an error occured if i entered same string for both.Please help to sort my problem
java login form using netbeans
java login form using netbeans  how to connect an access database to a login form using netbeans
login form - JSP-Servlet
login form  Q no.1:- Creat a login form in servlets?  Hi...*; import javax.servlet.http.*; public class Login extends HttpServlet...(); pw.println(""); pw.println("Login"); pw.println(""); pw.println
Login Authentication using Bean and Servlet In JSP
Login Authentication using Bean and Servlet In JSP... developed a web application of login authentication using Bean  in JSP. Five...;/body> <html> Output: ADS_TO_REPLACE_6 Login Authentication form
login form validation - JSP-Servlet
login form validation  hi, how to validate the login form that contains user name and password using post method . the validation should not allow user to login in the address bar thanks regards, anand
Login authentication
Login authentication  i want d code for login authentication from mysql database on the same pc using swings
Login authentication
Login authentication  i want d code for login authentication from mysql database on the same pc using swings
PHP MySQL Login Form
Login Form using PHP and MySQL: In any website generally it is mandatory to have a login form to keep your data secure. In this regard we need to have... will study how to create a login form, connect with the database server and login
Login issue using Servlet
Login issue using Servlet  Hi all, I need a code for login using servlet where in I want to check and validate user name and password from database also I want to check candidate's class (for ex. FY, SY, TY) if candidate's class
login page with mysql using jsp
login page with mysql using jsp  pls i need a sample of login page to check username and password in mysql database. thanks
Login Authentication using existing Active Directory.
Login Authentication using existing Active Directory.  I need jsp code for login authentication of username and password using already existing Active Directory. Here no need to create active directory.The JSP code should
Developing User Registration Form
Developing User Registration Form   ... necessary to develop the User Registration Form for our Struts, Hibernate and Spring based User Registration and Authentication Application. This section shows you
login form using java bean in eclipse
login form using java bean in eclipse  I have made a college community website but i need to implement beans to my login and contact us page. how can i do
code for user registration page and login page of emails using jsp
code for user registration page and login page of emails using jsp  hiiiiiii please send me the code for user registration page and login page of email using jsp and servlets and also code for database connectivity to oracle
Login Form using Ajax
Login Form using Ajax       This section provides you an easy and complete implementation of login form...; </action> Develop a Login Form Using Ajax : The GUI
Login Authentication and session in JSP - JSP-Servlet
Login Authentication and session in JSP  Hi, I am creating an small application in JSP,in which i need to check user authentication and session on each JSP page.Also how do i make logout page. Can you help me
Login form using Jsp in hibernate - Hibernate
Login form using Jsp in hibernate   Hai Friend, As I new To hibernate, I'm facing problem in My project(JSP with hibernate).. My login form... and entering into Menu Form.. plz can any one help for my problem... Thanks
redirecting a login authenticated form to a form to be displayed on the same page from where the login authentication has taken place.
redirecting a login authenticated form to a form to be displayed on the same page from where the login authentication has taken place.  I am successfully able to create a session on successful login, but I want to display
Login Form with Java GUI using Netbeans
Login Form with Java GUI using Netbeans  Hi there! I'm a beginner...(){ super("Login Authentication"); setSize(400,300); setLocation... have different user to login? Now that I've only administrator who is able
Spring 4: Login Form using Spring MVC and Hibernate Example
Spring 4 MVC Login Example: Database driven login form using Spring MVC... Here is the video tutorial of "Login Form using Spring MVC... Login form application in Spring MVC 4. In this section we will teach you how
add cookies to login form in jsp by using struts2.0 framework
add cookies to login form in jsp by using struts2.0 framework  hi sir... struts2.0 and hibernate3.0 and mysql database for login .jsp now i want to add cookies to above form please help me
login page using jsp servlrt with mysql database?
login page using jsp servlrt with mysql database?  Description: example:total users are 3.each use have username and password save in mysql database table login. After successfully login user1 see only index page,if user2 login
Login Form
of +,on clicking which a login form appears. Only the middle column is different for each of the page. How to write a code for login authentication so...Login Form  I have 8 jsp pages.Each of them has three columns:Left
Login Form
of +,on clicking which a login form appears. Only the middle column is different for each of the page. How to write a code for login authentication so...Login Form  I have 8 jsp pages.Each of them has three columns:Left
Spring 3 MVC Login Form Example with Database MySql
Spring 3 MVC Login Form Example with Database MySql  Sir i have checked your project of Spring 3 MVC Login Form Example But Sir Not able to do It with database Mysql. Can you Provide code for login with database. Thanks
User Registration Form Using JSP(JspBeans)
User Registration Form Using JSP(JspBeans)  ... of user registration form using jsp. One of the basic programming tactics... Step 1: Create a simple registration form (register.html):      
Spring Security Authorized Access Using Custom Login Form
Spring Security Authorized Access Using Custom Login Form In this section, you will learn about  authorized access using custom login form in Spring... access by providing  customized Login form using Spring Security. User
userregistration code -- http://www.roseindia.net/jsp/user-registration-form-using-jsp.shtml
userregistration code -- http://www.roseindia.net/jsp/user-registration-form-using-jsp.shtml  While running this application on netbeans7.0 , i am getting the following error: message /userregister/ description The requested
jsp page authentication panel using jsp/servlet?
jsp page authentication panel using jsp/servlet?  I have 10 jsp jsp forms and 7 users and i want to grant variour permission like edit,delete and save for users dynamically on forms.So please refer me code
How to put the logo in login form using swings/awt?
How to put the logo in login form using swings/awt?  Hi, How to put the logo in login form using swings/awt? I write the login form is working but i want to put the logo in login form plz help   Here is an example
Registration Form
Registration Form  Hi Friends I am Working on a small project.I have to create a Registration page using MVC pattern where i have to insert data username,password,date of birth,Mobile number number into database. How to insert
Display Logo on login form using swing
Display Logo on login form using swing In this tutorial, you will learn how to display a logo in login form using swing components. Here is an example where... a logo for this login form, we have used ImageIcon class that accepts the image

Ads