Rev 2060 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2005 | es | 1 | <%@ page import="pt.estgp.es.exemplos.hibernate.HibernateUtils" %> |
2 | <%@ page import="pt.estgp.es.exemplos.hibernate.Pagina" %> |
||
3 | <%@ page import="pt.estgp.es.exemplos.hibernate.Seccao" %><%-- |
||
4 | Created by IntelliJ IDEA. |
||
5 | pt.estgp.es.exemplos.hibernate.User: jmachado |
||
6 | Date: 29/10/2018 |
||
7 | Time: 15:03 |
||
8 | To change this template use File | Settings | File Templates. |
||
9 | --%> |
||
10 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> |
||
11 | <html> |
||
12 | <head> |
||
13 | <title></title> |
||
14 | </head> |
||
15 | <body> |
||
16 | |||
17 | <% |
||
18 | |||
19 | String id = request.getParameter("id"); |
||
20 | HibernateUtils.getCurrentSession().beginTransaction(); |
||
21 | |||
22 | Long idLong = id != null ? new Long(id) : (Long) request.getAttribute("id"); |
||
23 | |||
24 | |||
25 | |||
26 | Pagina p = (Pagina) HibernateUtils.getCurrentSession().load(Pagina.class,idLong); |
||
27 | |||
28 | %> |
||
29 | |||
30 | <h1><%=p.getNome()%> </h1> |
||
31 | |||
32 | <form action="<%=request.getContextPath()%>/paginas" method="post"> |
||
33 | |||
34 | <input type="hidden" name="idPagina" value="<%=idLong%>"/> |
||
35 | |||
36 | Adicionar Seccao<br/> |
||
37 | <input type="text" name="titulo"> |
||
38 | |||
39 | |||
40 | <button type="submit">Criar</button> |
||
41 | |||
42 | </form> |
||
43 | |||
44 | <% |
||
45 | for(Seccao s: p.getSeccoes()) |
||
46 | { |
||
47 | %> |
||
48 | <h2><%=s.getTitulo()%> |
||
49 | <a href="<%=request.getContextPath()%>/paginasDelete?idSeccao=<%=s.getId()%>"> |
||
50 | APAGAR |
||
51 | </a> |
||
52 | |||
53 | </h2> |
||
54 | <% |
||
55 | } |
||
56 | |||
57 | HibernateUtils.getCurrentSession().getTransaction().rollback(); |
||
58 | %> |
||
59 | |||
60 | </body> |
||
61 | </html> |