Biblioteca Java - Rev 19
Subversion Repositories:
(root)/Courses and labs samples/SCD/Servlet/WebApp/src/exemple/scd/web/AdaugaPersoanaServlet.java @ 36
package exemple.scd.web;
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 AdaugaPersoanaServlet
*/
@WebServlet(name = "adaugaPersoana", urlPatterns = { "/adaugaPersoana" })
public class AdaugaPersoanaServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String nume = request.getParameter("nume");
String prenume = request.getParameter("prenume");
PrintWriter out = response.getWriter();
out.println("Hello "+nume+" "+prenume);
out.close();
}
}
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 AdaugaPersoanaServlet
*/
@WebServlet(name = "adaugaPersoana", urlPatterns = { "/adaugaPersoana" })
public class AdaugaPersoanaServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String nume = request.getParameter("nume");
String prenume = request.getParameter("prenume");
PrintWriter out = response.getWriter();
out.println("Hello "+nume+" "+prenume);
out.close();
}
}