import java.io.IOException;
import java.util.Enumeration;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class RedirectServletExample extends HttpServlet
{
	public void doGet(HttpServletRequest req, HttpServletResponse res)
		throws IOException, ServletException
	{
		PrintWriter pw = res.getWriter();
		res.setContentType("text/html");
		if(req.getParameter("name").equals("abc")&& req.getParameter("psw").equals("xyz"))
		{
			res.sendRedirect("/SendRedirectExample/Welcome");
		}
		else
		{
			res.sendError(res.SC_BAD_REQUEST, "Please fill the right information");
		}
	}
}
