KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nextime > ion > admin > action > section > MoveSectionAction


1 package org.nextime.ion.admin.action.section;
2
3 import java.io.IOException JavaDoc;
4
5 import javax.servlet.ServletException JavaDoc;
6 import javax.servlet.http.HttpServletRequest JavaDoc;
7 import javax.servlet.http.HttpServletResponse JavaDoc;
8 import org.apache.struts.action.Action;
9 import org.apache.struts.action.ActionForm;
10 import org.apache.struts.action.ActionForward;
11 import org.apache.struts.action.ActionMapping;
12
13 import org.nextime.ion.framework.business.Section;
14 import org.nextime.ion.framework.mapping.Mapping;
15 import org.nextime.ion.framework.mapping.MappingException;
16
17 public class MoveSectionAction extends Action {
18
19     public ActionForward perform(
20         ActionMapping mapping,
21         ActionForm form,
22         HttpServletRequest JavaDoc request,
23         HttpServletResponse JavaDoc response)
24         throws IOException JavaDoc, ServletException JavaDoc {
25
26         try {
27             Mapping.begin();
28             Section s = Section.getInstance(request.getParameter("id"));
29             if (request.getParameter("type").equals("up")) {
30                 s.up();
31             } else {
32                 s.down();
33             }
34             Mapping.commit();
35         } catch (MappingException e) {
36             Mapping.rollback();
37             throw new ServletException JavaDoc(e);
38         }
39
40         return mapping.findForward("success");
41     }
42 }
Popular Tags