Mini-Project - Servlet, JSP Hands-On Solution
These Hands-On Solutions is only for Learning Purpose. Please utilize the service and learn the technology.
The Course Id of the Hands-On is 63718.
1. LoginServlet.java:-
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/Login")
public class LoginServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// your code here
String email = request.getParameter("email");
String password = request.getParameter("password");
boolean validated = Validate.checkUser(email, password);
PrintWriter writer = response.getWriter();
if(validated){
RequestDispatcher dispatcher = request.getRequestDispatcher("Welcome");
dispatcher.forward(request, response);
}else{
writer.write("Username or Password incorrect");
}
}
}
2. WelcomeServlet.java:-
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/Welcome")
public class WelcomeServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//your code here
PrintWriter writer = response.getWriter();
writer.write("Welcome user");
}
}
Mini-Project - Servlet, JSP Hands-On Solution
Reviewed by TECH UPDATE
on
December 31, 2021
Rating:
How to run project means correct command
ReplyDeletePlease check Image
DeletePlease add the terminal command also
Delete[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project LoginWebApp: Compilation failure
Delete[ERROR] /home/labuser/Desktop/Project/mvc-jsp-servlet/LoginWebApp/src/main/java/com/fresco/login/LoginServlet.java:[19,25] cannot find symbol
[ERROR] symbol: variable Validate
[ERROR] location: class LoginServlet
[ERROR] -> [Help 1]
symbol is not found error is coming
ReplyDeletewrite
cannot find symbol
ReplyDeletevariable write error is coming
How to create problem_statement.html page. I'm not getting this. Please help me.
ReplyDeletePlease tell me how to create problem_statement.html page. Because I referred the photo but I'm not getting how to create this page.
ReplyDeleteGetting error main method missing
ReplyDeleteThe code is not working
ReplyDeleteWhat is the command to run project
ReplyDeleteAfter running it is showing can't open install. Sh
ReplyDeleteHow to run this project pls explain me
ReplyDeletebro i am getting cannot find symbol validate in the loginservlet.java error what to do please help.
ReplyDeletePlease update 63717 course
ReplyDeletei am getting an error while running this please help the error is :-[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/home/labuser/Desktop/Project/mvc-jsp-servlet). Please verify you invoked Maven from the correct directory. -> [Help 1]
ReplyDelete[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
PLEASE HELP ME to fix this
Run command please
ReplyDelete