KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfox > petstore > action > ItemAction


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.petstore.action;
8
9 import javax.ejb.EJB JavaDoc;
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 /**
21  * @author <a HREF="mailto:jfox.young@gmail.com">Young Yang</a>
22  */

23 @Service(id="item", active = true)
24 public class ItemAction extends ActionSupport {
25
26     @EJB JavaDoc
27     ItemBO itemBO;
28
29     @ActionMethod(successView = "Item.vhtml", invocationClass = ItemInvocation.class)
30     public void doGetView(InvocationContext invocationContext) throws Exception JavaDoc {
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 JavaDoc itemId;
42
43         public String JavaDoc getItemId() {
44             return itemId;
45         }
46
47         public void setItemId(String JavaDoc itemId) {
48             this.itemId = itemId;
49         }
50     }
51 }
52
Popular Tags