KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > action > GalleryPageAction


1 package action;
2
3 import java.util.List JavaDoc;
4
5 import javax.servlet.http.HttpServletRequest JavaDoc;
6 import javax.servlet.http.HttpServletResponse JavaDoc;
7
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 import org.objectstyle.cayenne.access.DataContext;
13 import org.objectstyle.cayenne.conf.ServletUtil;
14 import org.objectstyle.cayenne.query.SelectQuery;
15
16 import webtest.Gallery;
17
18 public class GalleryPageAction extends Action {
19
20     public ActionForward execute(
21         ActionMapping mapping,
22         ActionForm form,
23         HttpServletRequest JavaDoc request,
24         HttpServletResponse JavaDoc response)
25         throws Exception JavaDoc {
26
27         DataContext ctxt =
28             ServletUtil.getSessionContext(request.getSession());
29
30         SelectQuery query = new SelectQuery(Gallery.class);
31
32         List JavaDoc galleries = ctxt.performQuery(query);
33         request.setAttribute("galleries", galleries);
34
35         return mapping.findForward("success");
36     }
37
38 }
39
Popular Tags