Java, .NET, PHP, PYTHON, ANGULAR, ML, Data Science, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"

Login and Registration for JSP


<%@include  file="header.jsp" %>

    <h1>Admin Login Here</h1>
    <form action="AdminSer" method="post">
        <input type="text" name="txtuser" placeholder="Enter username" />
        <input type="password" name="txtpass" placeholder="Enter password" />
        <input type="submit" name="btnsubmit" value="Login"/>

<%@include file="footer.jsp" %>


 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

 * @author Hp
public class AdminSer extends HttpServlet {

    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        try {
            PrintWriter out = response.getWriter();
            Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/stuinfo","root","");
            Statement st = con.createStatement();
            ResultSet x = st.executeQuery("select * from tbl_admin where username='"+request.getParameter("txtuser")+"' and password='"+request.getParameter("txtpass")+"'");
                out.print("invalid userid and password");
        } catch (Exception ex) {


Post a Comment

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post