package com.careerServices.MainApp;

import java.io.IOException;

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

public class ServletLogin extends HttpServlet 
{
	private static final long serialVersionUID = 1L;

    public ServletLogin() 
    {
        super();
    }
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
	{
		doPost(request, response);
	}
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
	{
		request.getRequestDispatcher("View/login.jsp").forward(request, response);
	}

}

@@ -60,16 +60,105 @@
 eption;%0D
+%0Aimport java.sql.Connection;%0D%0Aimport java.sql.DriverManager;%0D%0Aimport java.sql.ResultSet;%0D
 %0A%0D%0Aimpor
@@ -329,16 +329,60 @@
 nse;%0D%0A%0D%0A
+import com.mysql.jdbc.PreparedStatement;%0D%0A%0D%0A
 public c
@@ -818,16 +818,16 @@
 n %0D%0A%09%7B%0D%0A
-
 %09%09reques
@@ -899,14 +899,740 @@
 e);%0D%0A%09%7D%0D
+%0A%09public static boolean validate(String username, String pwd) %7B%0D%0A%09%09boolean status=false;%0D%0A%09%09String url = %22jdbc:mysql://sql9.freemysqlhosting.net:3306/sql9142409%22;%0D%0A        String usname = %22sql9142409%22;%0D%0A        String password = %22vjUyLx6eNN%22;%0D%0A%09%09try%7B  %0D%0A%09%09%09Class.forName(%22com.mysql.jdbc.Driver%22);  %0D%0A%09%09%09Connection con=DriverManager.getConnection(url,usname,password);  %0D%0A%09%09%09      %0D%0A%09%09%09PreparedStatement ps=(PreparedStatement) con.prepareStatement(%22select * from user where username=? and pwd=?%22);  %0D%0A%09%09%09ps.setString(1,username);  %0D%0A%09%09%09ps.setString(2,pwd);  %0D%0A%09%09%09      %0D%0A%09%09%09ResultSet rs=ps.executeQuery();  %0D%0A%09%09%09status=rs.next();  %0D%0A%09%09%09          %0D%0A%09%09%09%7Dcatch(Exception e)%7BSystem.out.println(e);%7D  %0D%0A%09%09%09return status;  %0D%0A%0D%0A%09%0D%0A%09%7D%0D
 %0A%0D%0A%7D%0D%0A

Update ServletLogin.java