

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;

/**
 * Servlet implementation class InregistrareDate
 */
@WebServlet("/InregistrareDate")
public class InregistrareDate extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public InregistrareDate() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		response.setContentType("text/html");
	    PrintWriter out = response.getWriter();
	    String title = "Valorile inregistrate GET";
	    out.println("<HTML>\n" +
	                "<BODY BGCOLOR=\"#FDF5E6\">\n" +
	                "<H1 ALIGN=\"CENTER\">" + title + "</H1>\n" +
	                "<form action='InregistrareDate' method='POST'> " +
	                "Introdu a: <input type='text' name='a'><br> " +
	                "Introdu b: <input type='text' name='b'> <br>" +
	                "Introdu c: <input type='text' name='c'><br> " +
	                "<input type='submit' value='Inregistreaza'> <br>" +
	                "</form> " +
	                "<UL>\n<LI><B> a= </B>: "
	                + request.getParameter("a") + "\n" +
	                "  <LI><B> b= </B>: "
	                + request.getParameter("b") + "\n" +
	                "  <LI><B> c= </B>: "
	                + request.getParameter("c") + "\n" +
	                   "</UL></BODY></HTML>");
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		response.setContentType("text/html");
	    PrintWriter out = response.getWriter();
	    String title = "Valorile inregistrate POST";
	    out.println("<HTML>\n" +
	                "<BODY BGCOLOR=\"#FDF5E6\">\n" +
	                "<H1 ALIGN=\"CENTER\">" + title + "</H1>\n" +
	                "<UL>\n<LI><B> a= </B>: "
	                + request.getParameter("a") + "\n" +
	                "  <LI><B> b= </B>: "
	                + request.getParameter("b") + "\n" +
	                "  <LI><B> c= </B>: "
	                + request.getParameter("c") + "\n" +
	                   "</UL></BODY></HTML>");
	}

}
