KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > roller > presentation > weblog > actions > WeblogQueryAction


1
2 package org.roller.presentation.weblog.actions;
3
4 import org.apache.struts.action.ActionForm;
5 import org.apache.struts.action.ActionForward;
6 import org.apache.struts.action.ActionMapping;
7 import org.apache.struts.actions.DispatchAction;
8
9 import java.io.IOException JavaDoc;
10
11 import javax.servlet.ServletException JavaDoc;
12 import javax.servlet.http.HttpServletRequest JavaDoc;
13 import javax.servlet.http.HttpServletResponse JavaDoc;
14
15 import org.roller.RollerException;
16 import org.roller.model.WeblogManager;
17 import org.roller.presentation.RollerRequest;
18 import org.roller.presentation.weblog.formbeans.WeblogQueryForm;
19
20
21 /////////////////////////////////////////////////////////////////////////////
22
/**
23  * Query weblog entries and display the results in tabular form.
24  *
25  * @struts.action path="/editor/weblogQuery" name="weblogQueryForm"
26  * scope="session" parameter="method"
27  *
28  * @struts.action-forward name="weblogQuery.page" path="/weblog/WeblogQuery.jsp"
29  */

30 public final class WeblogQueryAction extends DispatchAction
31 {
32     //-----------------------------------------------------------------------
33
/**
34      * Respond to request to add a new or edit an existing weblog entry.
35      * Loads the appropriate model objects and forwards the request to
36      * the edit weblog page.
37      */

38     public ActionForward query(
39         ActionMapping mapping,
40         ActionForm actionForm,
41         HttpServletRequest JavaDoc request,
42         HttpServletResponse JavaDoc response)
43         throws IOException JavaDoc, ServletException JavaDoc, RollerException
44     {
45         WeblogQueryForm form = (WeblogQueryForm)actionForm;
46         RollerRequest rreq = RollerRequest.getRollerRequest(request);
47         WeblogManager wmgr = rreq.getRoller().getWeblogManager();
48         
49         request.setAttribute("model", new WeblogQueryPageModel(
50            request,
51            response,
52            mapping,
53            rreq.getWebsite(),
54            form.getCategoryId(),
55            form.getStartDateString(),
56            form.getEndDateString(),
57            form.getStatus(),
58            form.getMaxEntries()));
59         
60         return mapping.findForward("weblogQuery.page");
61     }
62 }
63
Popular Tags