src/com/dream/action/ProductBackAction.java

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package com.dream.action;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.dream.bean.ProductBack;
import com.dream.page.PageModel;
import com.dream.page.PageView;
import com.dream.page.QueryResult;
import com.dream.service.ProductInService;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

@Controller @Scope(value="prototype")
public class ProductBackAction extends ActionSupport implements ModelDriven<PageModel>{

	@Resource(name = "productInServiceImpl")
	private ProductInService productInService;

	private PageModel pageModel = new PageModel();
	
	@Resource(name="pageView")
	private PageView<ProductBack> pageView;
	/**
	 * 分页显示商品信息
	 * @return
	 * @throws Exception
	 */
	public String list() throws Exception {
		HttpServletRequest request  = ServletActionContext.getRequest();	
		
		pageView.setCurrentpage(pageModel.getPage());
		pageView.setMaxresult(pageModel.getMaxresult());
		int fristindex = (pageModel.getPage()-1)*(pageModel.getMaxresult());
		QueryResult<ProductBack> qr = null;
		String query = request.getParameter("query");
		StringBuffer wherejpql = new StringBuffer();
		List<Object> params = new ArrayList<Object>();
		if("query".equals(query)){//查询页面
			String productid = request.getParameter("productid");
			 if(productid!=null&&!"".equals(productid.trim())){
				 if(params.size()>0){
					  wherejpql.append(" and");
				  }
		        	wherejpql.append(" o.product.id=?"+(params.size()+1));
		        	Long pid = Long.parseLong(productid);
		        	params.add(pid);
		     request.setAttribute("productid", productid);
			}
			 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); //yyyy-MM-dd HH:mm
			    String strstartDate = request.getParameter("beginTime");
后面还有 36 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。