I am making a login .JSP where on login button it called to login.java(servlet). But JSP is not able to call the servlet file and it gives an error.
Login.JSP
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>login</title>
</head>
<body>
<form action="Login" method="get">
Enter Username:<input type="text" name="uname"><br>
Enter Password:<input type="password" name="upass"><br>
<input type="submit" value="login">
</form>
</body>
</html>
Login.java(servlet file)
package com.login;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class Login
*/
@WebServlet("/Login")
public class Login extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String uname=request.getParameter("uname");
System.out.print("uname is"+uname);
String upass=request.getParameter("upass");
if (uname.equals("meet") && upass.equals("1234")) {
response.sendRedirect("welcome.jsp");
}
else {
response.sendRedirect("login.jsp");
}
}
}
ERROR MESSAGE HTTP Status 404 – Not Found
Type Status Report
Message /Login
Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.