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.form.TopicForm;
8   import hu.elte.tribus.interfaces.QaDao;
9   import hu.elte.tribus.model.Topic;
10  
11  import javax.servlet.http.HttpServletRequest;
12  import javax.servlet.http.HttpServletResponse;
13  
14  import org.apache.struts.action.ActionForm;
15  import org.apache.struts.action.ActionForward;
16  import org.apache.struts.action.ActionMapping;
17  import org.springframework.web.struts.ActionSupport;
18  
19  /*** 
20   * MyEclipse Struts
21   * Creation date: 11-12-2006
22   * 
23   * XDoclet definition:
24   * @struts.action validate="true"
25   */
26  public class EditTopicAction extends ActionSupport {
27  	/*
28  	 * Generated Methods
29  	 */
30  
31  	/*** 
32  	 * Method execute
33  	 * @param mapping
34  	 * @param form
35  	 * @param request
36  	 * @param response
37  	 * @return ActionForward
38  	 */
39  	public ActionForward execute(ActionMapping mapping, ActionForm form,
40  			HttpServletRequest request, HttpServletResponse response) {
41  		if(request.getParameter("new") == null)
42  		{
43  			QaDao qaDao = (QaDao) getWebApplicationContext().getBean("qaDao");
44  			Topic topic = qaDao.getTopicById(Integer.parseInt(request.getParameter("id")));
45  			//request.setAttribute("topic", topic);
46  			TopicForm topicForm = (TopicForm)form;
47  			topicForm.setName(topic.getName());
48  			topicForm.setDesc(topic.getDesc());
49  			request.setAttribute("id", request.getParameter("id"));
50  		}
51  		return mapping.findForward("ok");
52  	}
53  }