searchaction.java

来自「网上商城一个购物网站具有登陆会员注册添加购物车」· Java 代码 · 共 44 行

JAVA
44 行
字号
package hit.struts.action;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;

import hit.bean.*;
import hit.persistence.*;

public final class SearchAction extends Action{  
	public ActionForward execute(
		ActionMapping mapping,
		ActionForm form,
		HttpServletRequest request,  
		HttpServletResponse response) throws Exception {
	
   		DynaActionForm searchForm = (DynaActionForm) form;         
		Integer sortId = (Integer)searchForm.get("sortId");
		String keyword = (String)searchForm.get("keyword");
		Integer pageId = (Integer)searchForm.get("pageId");
		
		int pageCount = 0;
		int iPageId = 0;
		if (pageId!=null) iPageId = pageId.intValue();
		if (iPageId<0) iPageId = 0;
		String PageForward="toListMain";
		ActionErrors errors = new ActionErrors();
		
		List productList=new DBOperate().getMatchProducts(sortId.intValue(),keyword);
	
	    HttpSession session = request.getSession(true);
		/*
		 * 娌℃湁鎼滅储鍒板晢鍝佸

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?