1 package xpetstore.web.struts.action.item; 2 3 import javax.servlet.http.HttpServletRequest ; 4 import javax.servlet.http.HttpServletResponse ; 5 6 import org.apache.struts.action.ActionForm; 7 import org.apache.struts.action.ActionForward; 8 import org.apache.struts.action.ActionMapping; 9 10 import xpetstore.domain.catalog.ejb.Item; 11 import xpetstore.domain.catalog.ejb.Product; 12 13 import xpetstore.services.petstore.ejb.Petstore; 14 15 import xpetstore.web.struts.action.BaseAction; 16 17 18 31 public class ItemAction 32 extends BaseAction 33 { 34 36 39 protected ActionForward doExecute( ActionMapping mapping, 40 ActionForm form, 41 HttpServletRequest request, 42 HttpServletResponse response ) 43 throws Exception 44 { 45 ItemForm frm = ( ItemForm ) form; 46 String itemId = frm.getItemId( ); 47 Petstore petstore = getPetstore( ); 48 49 50 Item item = petstore.getItem( itemId ); 51 frm.setItem( item ); 52 53 54 Product product = petstore.getProductByItem( itemId ); 55 frm.setProduct( product ); 56 57 return mapping.findForward( SUCCESS ); 58 } 59 } 60 | Popular Tags |