1 7 package org.jfox.petstore.action; 8 9 import javax.ejb.EJB ; 10 11 import org.jfox.petstore.bo.ItemBO; 12 import org.jfox.petstore.entity.Item; 13 import org.jfox.framework.annotation.Service; 14 import org.jfox.mvc.ActionSupport; 15 import org.jfox.mvc.Invocation; 16 import org.jfox.mvc.InvocationContext; 17 import org.jfox.mvc.PageContext; 18 import org.jfox.mvc.annotation.ActionMethod; 19 20 23 @Service(id="item", active = true) 24 public class ItemAction extends ActionSupport { 25 26 @EJB 27 ItemBO itemBO; 28 29 @ActionMethod(successView = "Item.vhtml", invocationClass = ItemInvocation.class) 30 public void doGetView(InvocationContext invocationContext) throws Exception { 31 ItemInvocation invocation = (ItemInvocation)invocationContext.getInvocation(); 32 Item item = itemBO.getItem(invocation.getItemId()); 33 34 PageContext pageContext = invocationContext.getPageContext(); 35 36 pageContext.setAttribute("item",item); 37 38 } 39 40 public static class ItemInvocation extends Invocation { 41 private String itemId; 42 43 public String getItemId() { 44 return itemId; 45 } 46 47 public void setItemId(String itemId) { 48 this.itemId = itemId; 49 } 50 } 51 } 52 | Popular Tags |