1
2
3
4
5 package hu.elte.tribus.action;
6
7 import hu.elte.tribus.interfaces.QaDao;
8 import hu.elte.tribus.model.QA;
9
10 import javax.servlet.http.HttpServletRequest;
11 import javax.servlet.http.HttpServletResponse;
12
13 import org.apache.struts.action.ActionForm;
14 import org.apache.struts.action.ActionForward;
15 import org.apache.struts.action.ActionMapping;
16 import org.springframework.web.struts.ActionSupport;
17
18 /***
19 * MyEclipse Struts
20 * Creation date: 11-12-2006
21 *
22 * XDoclet definition:
23 * @struts.action validate="true"
24 */
25 public class DeleteQAAction extends ActionSupport {
26
27
28
29
30 /***
31 * Method execute
32 * @param mapping
33 * @param form
34 * @param request
35 * @param response
36 * @return ActionForward
37 */
38 public ActionForward execute(ActionMapping mapping, ActionForm form,
39 HttpServletRequest request, HttpServletResponse response) {
40 QaDao qaDao = (QaDao) getWebApplicationContext().getBean("qaDao");
41
42 QA qa = qaDao.getQaById(Integer.parseInt(request.getParameter("id")));
43 qaDao.deleteQa(qa);
44 request.setAttribute("qa.list", qaDao.getQaList());
45 return mapping.findForward("ok");
46 }
47 }