View Javadoc

1   /*
2    * Generated by MyEclipse Struts
3    * Template path: templates/java/JavaClass.vtl
4    */
5   package hu.elte.tribus.action;
6   
7   import hu.elte.tribus.interfaces.QaDao;
8   import hu.elte.tribus.model.Topic;
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 DelTopicAction extends ActionSupport {
26  	/*
27  	 * Generated Methods
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  		Topic topic = qaDao.getTopicById(Integer.parseInt(request.getParameter("id")));
42  		qaDao.deleteTopic(topic);
43  		request.setAttribute("topics", qaDao.getTopicList());
44  		return mapping.findForward("ok");
45  	}
46  }