Blame |
Last modification |
View Log
| RSS feed
package pt.estgp.es.exemplos.hibernate.web;
import pt.estgp.es.exemplos.hibernate.HibernateUtils;
import pt.estgp.es.exemplos.hibernate.services.ServicoPaginas;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Created by joaoe on 29-10-2018.
*/
public class PaginasServlet
extends HttpServlet
{
protected void doPost
(HttpServletRequest request, HttpServletResponse response
) throws ServletException,
1.5.0/docs/api/java/io/IOException.html">IOException{
1.5.0/docs/api/java/lang/String.html">String titulo = request.
getParameter("titulo");
1.5.0/docs/api/java/lang/String.html">String idPagina = request.
getParameter("idPagina");
HibernateUtils.
getCurrentSession().
beginTransaction();
new ServicoPaginas
().
criaSeccaoService(idPagina,titulo
);
HibernateUtils.
getCurrentSession().
getTransaction().
commit();
//so pode ter isto quando for implementado o servico
//new ServicoPaginas().criaSeccaoService(idPagina,titulo);
request.
setAttribute("id",
new 1.5.0/docs/api/java/lang/Long.html">Long(idPagina
));
request.
getRequestDispatcher("apresentaPagina.jsp").
forward(request,response
);
}
protected void doGet
(HttpServletRequest request, HttpServletResponse response
) throws ServletException,
1.5.0/docs/api/java/io/IOException.html">IOException {
doPost
(request,response
);
}
}