bacoAlunos
ENGSOFT2019
BlueGrey
calm
Elegant
Català-Valencià - Catalan
中文 - Chinese (Simplified)
中文 - Chinese (Traditional)
Česky - Czech
Dansk - Danish
Nederlands - Dutch
English - English
Suomi - Finnish
Français - French
Deutsch - German
עברית - Hebrew
हिंदी - Hindi
Magyar - Hungarian
Bahasa Indonesia - Indonesian
Italiano - Italian
日本語 - Japanese
한국어 - Korean
मराठी - Marathi
Norsk - Norwegian
Polski - Polish
Português - Portuguese
Português - Portuguese (Brazil)
Русский - Russian
Slovenčina - Slovak
Slovenščina - Slovenian
Español - Spanish
Svenska - Swedish
Türkçe - Turkish
Oëzbekcha - Uzbek
Subversion Repositories
bacoAlunos
(root)
/
es2018
/
17210
/
src
/
java
/
pt
/
estgp
/
es
/
exemplos
/
hibernate
/
web
/
PaginasDeleteServlet.java
@ 2030
- Rev 2030
Rev
Go to most recent revision
|
Blame
|
Compare with Previous
|
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.Seccao
;
import
java.io.IOException
;
public
class
PaginasDeleteServlet
extends
javax.
servlet
.
http
.
HttpServlet
{
protected
void
doPost
(
javax.
servlet
.
http
.
HttpServletRequest
request, javax.
servlet
.
http
.
HttpServletResponse
response
)
throws
javax.
servlet
.
ServletException
,
1.
5
.0/docs/api/java/io/IOException.html">
IOException
{
1.
5
.0/docs/api/java/lang/String.html">
String
idSeccao = request.
getParameter
(
"idSeccao"
)
;
HibernateUtils.
getCurrentSession
(
)
.
beginTransaction
(
)
;
Seccao seccao =
(
Seccao
)
HibernateUtils.
getCurrentSession
(
)
.
load
(
Seccao.
class
,
new
1.
5
.0/docs/api/java/lang/Long.html">
Long
(
idSeccao
)
)
;
1.
5
.0/docs/api/java/lang/Long.html">
Long
idPagina = seccao.
getPagina
(
)
.
getId
(
)
;
seccao.
getPagina
(
)
.
getSeccoes
(
)
.
remove
(
seccao
)
;
seccao.
setPagina
(
null
)
;
HibernateUtils.
getCurrentSession
(
)
.
delete
(
seccao
)
;
HibernateUtils.
getCurrentSession
(
)
.
getTransaction
(
)
.
commit
(
)
;
request.
setAttribute
(
"id"
,idPagina
)
;
request.
getRequestDispatcher
(
"apresentaPagina.jsp"
)
.
forward
(
request,response
)
;
}
protected
void
doGet
(
javax.
servlet
.
http
.
HttpServletRequest
request, javax.
servlet
.
http
.
HttpServletResponse
response
)
throws
javax.
servlet
.
ServletException
,
1.
5
.0/docs/api/java/io/IOException.html">
IOException
{
doPost
(
request,response
)
;
}
}