Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2007 | 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 | <%-- |
||
5 | Created by IntelliJ IDEA. |
||
6 | User: joaoe |
||
7 | Date: 29-10-2018 |
||
8 | Time: 15:05 |
||
9 | To change this template use File | Settings | File Templates. |
||
10 | --%> |
||
11 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> |
||
12 | <html> |
||
13 | <head> |
||
14 | <title></title> |
||
15 | </head> |
||
16 | <body> |
||
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 | Pagina p = (Pagina) HibernateUtils.getCurrentSession().load(Pagina.class,idLong); |
||
25 | |||
26 | |||
27 | %> |
||
28 | |||
29 | <h1><%= p.getNome()%></h1> |
||
30 | |||
31 | <form action=<%request.getContextPath()%>"paginas" method="post"> |
||
32 | |||
33 | <input type="hiden" name="idPagina" value="<%idLong%>"/> |
||
34 | |||
35 | Adicionar seccao <br/> |
||
36 | <input type="text" name="titulo"> |
||
37 | |||
38 | <button type="submit">Criar</button> |
||
39 | </form> |
||
40 | <% |
||
41 | for(Seccao s : p.getSeccoes()) |
||
42 | { |
||
43 | %> |
||
44 | <h2><%s.getTitulo()%> |
||
45 | <a href="<%request.getContextPath()%>/paginasDelete?idSeccao=<%s.getId()%>"> |
||
46 | APAGAR |
||
47 | </a> |
||
48 | </h2> |
||
49 | <% |
||
50 | } |
||
51 | |||
52 | HibernateUtils.getCurrentSession().getTransaction().rollback(); |
||
53 | %> |
||
54 | |||
55 | </body> |
||
56 | </html> |