基于J2EE的电子商务网站实例解析 - 编程入门网
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-06-23
action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import com.routease.action.PagingAction; import com.routease.action.helper.UserHelper; import com.routease.db.dao.DataSource; import com.routease.db.dao.totradeentity.SearchingCriteria; import com.routease.db.dao.totradeentity.ToTradeEntityDAO; import com.routease.db.util.Constants; import com.routease.db.util.Page; public class SearchToTradeEntityAction extends PagingAction { public SearchToTradeEntityAction() { super(); } // executeWithDataSource方法为该Action默认执行的方法 public ActionForward executeWithDataSource(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response, DataSource ds) throws Exception { //首先接受用户提交的表单数据 String objective = (String) PropertyUtils.getSimpleProperty (actionForm, "objective"); String keyWords = (String) PropertyUtils.getSimpleProperty (actionForm, "keyWords"); String keyWordsRange = (String) PropertyUtils.getSimpleProperty(actionForm, "keyWordsRange"); if (StringUtils.isEmpty(keyWordsRange)) { keyWordsRange = SearchingCriteria.KEY_WORDS_RANGE_NAME; } String industryLevel1 = (String) PropertyUtils.getSimpleProperty(actionForm, "industryLevel1"); String industryLevel2 = (String) PropertyUtils.getSimpleProperty(actionForm, "industryLevel2"); String startingPrice = (String) PropertyUtils.getSimpleProperty(actionForm, "startingPrice"); String endingPrice = (String) PropertyUtils.getSimpleProperty (actionForm, "endingPrice"); String city = (String) PropertyUtils.getSimpleProperty (actionForm, "city"); String province = (String) PropertyUtils.getSimpleProperty (actionForm, "province"); String startNoStr = (String) PropertyUtils.getSimpleProperty (actionForm, "startNumber"); String lengthStr = (String) PropertyUtils.getSimpleProperty (actionForm, "length"); if (StringUtils.isEmpty(startNoStr)) { startNoStr = "1"; } //根据用户提交的数据,创建查询表达式对象SC int startNumber = Integer.parseInt(startNoStr); int length = UserHelper.getPagingLength(ds, request); ToTradeEntityDAO serviceDAO = new ToTradeEntityDAO(ds); SearchingCriteria sc = new SearchingCriteria(); sc.setCity(city); sc.setProvince(province); sc.setEndingPrice(endingPrice); sc.setIndustryLevel1(industryLevel1); sc.setIndustryLevel2(industryLevel2); sc.setKeyWords(keyWords); sc.setKeyWordsRange(keyWordsRange); sc.setObjective(objective); sc.setStartingPrice(startingPrice); if (Constants.IS_TEST) { System.out.println("start of page:" + startNumber); } //提交查询对象SC,并获得查询结果集,将其结果集放入Request对象中 ,便于返回 Page result = serviceDAO.searc |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于基于J2EE的电子商务网站实例解析 - 编程入门网的所有评论