KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > xpetstore > web > webwork > action > item > ItemAction


1 /*
2  * Created on 24-Feb-2003
3  */

4 package xpetstore.web.webwork.action.item;
5
6 import cirrus.hibernate.Session;
7
8 import xpetstore.domain.Item;
9
10 import xpetstore.web.webwork.action.BaseAction;
11
12
13 /**
14  * @author <a HREF="mailto:tchbansi@sourceforge.net">Herve Tchepannou</a>
15  *
16  * @webwork.action
17  * name="item"
18  * success="item.vm"
19  */

20 public class ItemAction
21     extends BaseAction
22 {
23     //~ Instance fields --------------------------------------------------------
24

25     private String JavaDoc _itemId;
26     private Item _item;
27
28     //~ Methods ----------------------------------------------------------------
29

30     /**
31      * @see webwork.action.ActionSupport#doExecute()
32      */

33     protected String JavaDoc doExecute( )
34         throws Exception JavaDoc
35     {
36         Session s = getHibernateSession( );
37
38         try
39         {
40             _item = ( Item ) s.load( Item.class, _itemId );
41
42             return SUCCESS;
43         }
44         finally
45         {
46             s.close( );
47         }
48     }
49
50     /**
51      * @return String
52      */

53     public String JavaDoc getItemId( )
54     {
55         return _itemId;
56     }
57
58     /**
59      * Sets the itemId.
60      * @param itemId The itemId to set
61      */

62     public void setItemId( String JavaDoc itemId )
63     {
64         _itemId = itemId;
65     }
66
67     /**
68      * @return Item
69      */

70     public Item getItem( )
71     {
72         return _item;
73     }
74
75     /**
76      * Sets the item.
77      * @param item The item to set
78      */

79     public void setItem( Item item )
80     {
81         _item = item;
82     }
83 }
84
Popular Tags