1 package xpetstore.web.struts.action.category; 2 3 import java.util.Collection ; 4 5 import javax.servlet.http.HttpServletRequest ; 6 import javax.servlet.http.HttpServletResponse ; 7 8 import org.apache.struts.action.ActionForm; 9 import org.apache.struts.action.ActionForward; 10 import org.apache.struts.action.ActionMapping; 11 12 import xpetstore.domain.catalog.ejb.Category; 13 14 import xpetstore.services.petstore.ejb.Petstore; 15 16 import xpetstore.web.struts.action.BaseAction; 17 18 19 32 public class CategoryAction 33 extends BaseAction 34 { 35 37 40 protected ActionForward doExecute( ActionMapping mapping, 41 ActionForm form, 42 HttpServletRequest request, 43 HttpServletResponse response ) 44 throws Exception 45 { 46 CategoryForm frm = ( CategoryForm ) form; 47 String categoryId = frm.getCategoryId( ); 48 Petstore petstore = getPetstore( ); 49 50 51 Category category = petstore.getCategory( categoryId ); 52 frm.setCategory( category ); 53 54 55 Collection products = petstore.getProducts( categoryId, 0, Integer.MAX_VALUE ).getList( ); 56 frm.setProducts( products ); 57 58 return mapping.findForward( SUCCESS ); 59 } 60 } 61 | Popular Tags |