74 lines
2.1 KiB
Java
74 lines
2.1 KiB
Java
package servlet;
|
|
|
|
import test2_constraints_validation.*;
|
|
import test3_persistence.store_class;
|
|
import test3_persistence.test_class;
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.ejb.Stateless;
|
|
import javax.inject.Inject;
|
|
import javax.persistence.EntityManager;
|
|
import javax.persistence.PersistenceContext;
|
|
import javax.servlet.ServletException;
|
|
import javax.servlet.annotation.WebServlet;
|
|
import javax.servlet.http.HttpServlet;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.transaction.*;
|
|
import javax.validation.ConstraintViolation;
|
|
import javax.validation.Validator;
|
|
import javax.validation.ValidatorFactory;
|
|
import javax.validation.executable.ExecutableValidator;
|
|
import java.io.IOException;
|
|
import java.io.PrintWriter;
|
|
import java.lang.reflect.Method;
|
|
import java.util.Iterator;
|
|
import java.util.Set;
|
|
|
|
/**
|
|
* Created by Giovanni on 25/04/2015.
|
|
*/
|
|
|
|
@WebServlet(name = "Servlettest3")
|
|
public class Servlettest3 extends HttpServlet {
|
|
|
|
|
|
@Inject
|
|
store_class s;
|
|
|
|
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
response.setContentType("text/html;charset=UTF-8");
|
|
try (PrintWriter out = response.getWriter()) {
|
|
/* TODO output your page here. */
|
|
|
|
out.println("<!DOCTYPE html>");
|
|
out.println("<html>");
|
|
out.println("<head>");
|
|
out.println("<title>Servlet xg</title>");
|
|
out.println("</head>");
|
|
out.println("<body>");
|
|
out.println("<h1>Servlet xg at " + request.getContextPath() + "</h1>");
|
|
|
|
|
|
s.store_class(new test_class() );
|
|
|
|
|
|
|
|
out.println("</body>");
|
|
out.println("</html>");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
processRequest(request, response);
|
|
|
|
}
|
|
|
|
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
processRequest(request, response);
|
|
|
|
}
|
|
}
|