Rev 2018 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2018 | Rev 2049 | ||
---|---|---|---|
Line 14... | Line 14... | ||
14 | <html> |
14 | <html> |
15 | <head> |
15 | <head> |
16 | <title></title> |
16 | <title></title> |
17 | </head> |
17 | </head> |
18 | <body> |
18 | <body> |
- | 19 | <% |
|
- | 20 | if(UserSession.getUser() != null) |
|
- | 21 | { |
|
19 | 22 | ||
- | 23 | } |
|
- | 24 | %> |
|
20 | Olá ${UserSession.user.nome} estamos a ver uma página. |
25 | Olá ${UserSession.user.nome} estamos a ver uma página. |
21 | 26 | ||
22 | <% |
27 | <% |
23 | 28 | ||
24 | pt.estgp.es.exemplos.hibernate.UserSession sess = SecurityFilter.loadSessionProxy(request); |
- | |
25 | String id = request.getParameter("id"); |
- | |
26 | HibernateUtils.getCurrentSession().beginTransaction(); |
- | |
27 | 29 | ||
- | 30 | pt.estgp.es.exemplos.hibernate.UserSession sess = SecurityFilter.loadSessionProxy(request); |
|
28 | Long idLong = id != null ? new Long(id) : (Long) request.getAttribute("id"); |
31 | String id = request.getParameter("id"); |
- | 32 | HibernateUtils.getCurrentSession().beginTransaction(); |
|
29 | 33 | ||
- | 34 | Long idLong = id != null ? new Long(id) : (Long) request.getAttribute("id"); |
|
30 | 35 | ||
31 | 36 | ||
32 | Pagina p = (Pagina) HibernateUtils.getCurrentSession().load(Pagina.class,idLong); |
- | |
33 | 37 | ||
34 | %> |
- | |
- | 38 | Pagina p = (Pagina) HibernateUtils.getCurrentSession().load(Pagina.class,idLong); |
|
35 | 39 | ||
36 | <h1><%=p.getNome()%> </h1> |
40 | %> |
37 | 41 | ||
38 | <form action="<%=request.getContextPath()%>/paginas" method="post"> |
42 | <h1><%=p.getNome()%> </h1> |
39 | 43 | ||
40 | <input type="hidden" name="idPagina" value="<%=idLong%>"/> |
44 | <form action="<%=request.getContextPath()%>/paginas" method="post"> |
41 | 45 | ||
42 | Adicionar Seccao<br/> |
- | |
43 | <input type="text" name="titulo"> |
46 | <input type="hidden" name="idPagina" value="<%=idLong%>"/> |
44 | 47 | ||
- | 48 | Adicionar Seccao<br/> |
|
- | 49 | <input type="text" name="titulo"> |
|
45 | 50 | ||
46 | <button type="submit">Criar</button> |
- | |
47 | 51 | ||
48 | </form> |
52 | <button type="submit">Criar</button> |
49 | 53 | ||
50 | <% |
- | |
51 | for(Seccao s: p.getSeccoes()) |
- | |
52 | { |
54 | </form> |
53 | 55 | ||
- | 56 | <% |
|
- | 57 | for(Seccao s: p.getSeccoes()) |
|
- | 58 | { |
|
54 | 59 | ||
55 | %> |
- | |
56 | <h2><%=s.getTitulo()%> |
- | |
57 | <a href="<%=request.getContextPath()%>/paginasDelete?idSeccao=<%=s.getId()%>"> |
- | |
58 | APAGAR |
- | |
59 | </a> |
- | |
60 | 60 | ||
61 | </h2> |
61 | %> |
62 | <% |
62 | <h2><%=s.getTitulo()%> |
- | 63 | <a href="<%=request.getContextPath()%>/paginasDelete?idSeccao=<%=s.getId()%>"> |
|
- | 64 | APAGAR |
|
63 | } |
65 | </a> |
64 | 66 | ||
- | 67 | </h2> |
|
- | 68 | <% |
|
- | 69 | } |
|
- | 70 | ||
65 | HibernateUtils.getCurrentSession().getTransaction().rollback(); |
71 | HibernateUtils.getCurrentSession().getTransaction().rollback(); |
66 | %> |
72 | %> |
67 | 73 | ||
68 | </body> |
74 | </body> |
69 | </html> |
75 | </html> |