1 package xpetstore.web.struts.action.product; 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.services.petstore.ejb.Petstore; 13 14 import xpetstore.web.struts.action.BaseAction; 15 16 17 30 public class SearchAction 31 extends BaseAction 32 { 33 35 38 protected ActionForward doExecute( ActionMapping mapping, 39 ActionForm form, 40 HttpServletRequest request, 41 HttpServletResponse response ) 42 throws Exception 43 { 44 SearchForm frm = ( SearchForm ) form; 45 String keyword = frm.getKeyword( ); 46 Petstore petstore = getPetstore( ); 47 48 Collection products = petstore.searchProducts( keyword, 0, Integer.MAX_VALUE ).getList( ); 49 frm.setProductValues( products ); 50 51 return mapping.findForward( SUCCESS ); 52 } 53 } 54 | Popular Tags |