KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nextime > ion > backoffice > action > resource > ResourceManagementAction


1 package org.nextime.ion.backoffice.action.resource;
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.ActionForm;
9 import org.apache.struts.action.ActionForward;
10 import org.apache.struts.action.ActionMapping;
11 import org.nextime.ion.backoffice.action.BaseAction;
12 import org.nextime.ion.backoffice.bean.ResourceXmlBean;
13 import org.nextime.ion.backoffice.bean.Resources;
14
15 public class ResourceManagementAction extends BaseAction {
16
17     public ActionForward perform(
18         ActionMapping mapping,
19         ActionForm form,
20         HttpServletRequest JavaDoc request,
21         HttpServletResponse JavaDoc response)
22         throws IOException JavaDoc, ServletException JavaDoc {
23
24         // check if user is correctly logged
25
checkUser(request);
26
27         if (request.getParameter("select") != null) {
28             request.getSession().setAttribute(
29                 "selectedResources",
30                 request.getParameter("select"));
31
32         }
33
34         String JavaDoc selected =
35             (String JavaDoc) request.getSession().getAttribute("selectedResources");
36         try {
37             if (selected == null) {
38                 selected =
39                     ((ResourceXmlBean) Resources
40                         .getResourceXmlBeans(servlet)
41                         .get(0))
42                         .getId();
43             }
44             request.getSession().setAttribute("selectedResources", selected);
45         } catch (Exception JavaDoc e) {
46             e.printStackTrace();
47         }
48
49         // Forward back to the test page
50
return (mapping.findForward("view"));
51
52     }
53
54 }
55
Popular Tags