KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > formview > usecases > action > DisplayerConfigAction


1 package net.sourceforge.formview.usecases.action;
2
3 import javax.servlet.http.HttpServletRequest JavaDoc;
4 import javax.servlet.http.HttpServletResponse JavaDoc;
5
6 import org.apache.struts.action.ActionForm;
7 import org.apache.struts.action.ActionForward;
8 import org.apache.struts.action.ActionMapping;
9
10 import net.sourceforge.formview.struts.action.FormViewDispatchAction;
11 import net.sourceforge.formview.usecases.form.DisplayerConfigForm;
12 import net.sourceforge.formview.util.WEBFormViewUtil;
13
14 /**
15  *
16  * Description : Action for display all HTML elements with different states.
17  *
18  * @version 1.0.0
19  * @author <a HREF="mailto:angelo.zerr@gmail.com">Angelo ZERR</a>
20  *
21  */

22 public class DisplayerConfigAction extends FormViewDispatchAction {
23
24     public ActionForward load(ActionMapping mapping, ActionForm actionForm,
25             HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) throws Exception JavaDoc {
26         DisplayerConfigForm form = (DisplayerConfigForm)actionForm;
27         
28         form.setHTMLInputText("HTMLInputText value");
29         form.setHTMLInputCheckbox("");
30         form.setHTMLTextarea("HTMLTextarea value");
31         
32         return display( mapping, actionForm, request, response);
33     }
34     
35     public ActionForward display(ActionMapping mapping, ActionForm actionForm,
36             HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) throws Exception JavaDoc {
37         
38         return mapping.findForward("display");
39     }
40
41     public ActionForward changeState(ActionMapping mapping, ActionForm actionForm,
42             HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) throws Exception JavaDoc {
43         DisplayerConfigForm form = (DisplayerConfigForm)actionForm;
44         String JavaDoc state = form.getState();
45         // Set state
46
WEBFormViewUtil.saveState(request, getServlet().getServletContext(), state);
47         
48         return mapping.findForward("display");
49     }
50     
51 }
52
Popular Tags