KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfox > manager > demo > CheckboxAction


1 /*
2  * JFox - The most lightweight Java EE Application Server!
3  * more details please visit http://www.huihoo.org/jfox or http://www.jfox.org.cn.
4  *
5  * JFox is licenced and re-distributable under GNU LGPL.
6  */

7 package org.jfox.manager.demo;
8
9 import org.jfox.framework.annotation.Service;
10 import org.jfox.mvc.ActionSupport;
11 import org.jfox.mvc.InvocationContext;
12 import org.jfox.mvc.Invocation;
13 import org.jfox.mvc.PageContext;
14 import org.jfox.mvc.annotation.ActionMethod;
15
16 /**
17  * @author <a HREF="mailto:jfox.young@gmail.com">Young Yang</a>
18  */

19 @Service(id="checkbox")
20 public class CheckboxAction extends ActionSupport {
21
22     @ActionMethod(successView = "demo/checkbox.vhtml")
23     public void doGetView(InvocationContext invocationContext) throws Exception JavaDoc{
24         // do nothing, just show template
25
}
26
27     @ActionMethod(successView = "demo/checkbox.vhtml", invocationClass = CheckboxInvocation.class)
28     public void doPostSubmit(InvocationContext invocationContext) throws Exception JavaDoc{
29         CheckboxInvocation invocation = (CheckboxInvocation)invocationContext.getInvocation();
30         String JavaDoc[] fruits = invocation.getFruit();
31         PageContext pageContext = invocationContext.getPageContext();
32         pageContext.setAttribute("fruits", fruits);
33     }
34
35     public static class CheckboxInvocation extends Invocation {
36         String JavaDoc[] fruit = new String JavaDoc[0];
37
38         public String JavaDoc[] getFruit() {
39             return fruit;
40         }
41
42         public void setFruit(String JavaDoc[] fruit) {
43             this.fruit = fruit;
44         }
45     }
46
47     public static void main(String JavaDoc[] args) {
48
49     }
50 }
51
Popular Tags