1 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 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 { 24 } 26 27 @ActionMethod(successView = "demo/checkbox.vhtml", invocationClass = CheckboxInvocation.class) 28 public void doPostSubmit(InvocationContext invocationContext) throws Exception { 29 CheckboxInvocation invocation = (CheckboxInvocation)invocationContext.getInvocation(); 30 String [] fruits = invocation.getFruit(); 31 PageContext pageContext = invocationContext.getPageContext(); 32 pageContext.setAttribute("fruits", fruits); 33 } 34 35 public static class CheckboxInvocation extends Invocation { 36 String [] fruit = new String [0]; 37 38 public String [] getFruit() { 39 return fruit; 40 } 41 42 public void setFruit(String [] fruit) { 43 this.fruit = fruit; 44 } 45 } 46 47 public static void main(String [] args) { 48 49 } 50 } 51 | Popular Tags |