⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 searchaction.java

📁 利用当前管理信息系统科学的、实用的理论
💻 JAVA
字号:
package com.haizi.struts.action;

import java.sql.Date;
import java.sql.ResultSet;

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.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.haizi.struts.formbean.StoreForm;

public class SearchAction extends Action {
public ResultSet rs;
	
	public ActionForward execute(
		ActionMapping mapping,
		ActionForm form,
		HttpServletRequest request,
		HttpServletResponse response) {
/*		int spareno =((StoreForm) form).getSpare_no();
		String sparename = ((StoreForm) form).getSpare_name();
		int storeno = ((StoreForm)form).getStore_no();
		Date date = ((StoreForm)form).getDate();
		
		DBConnect dbc = null;
		try{
			dbc  = new DBConnect();
			dbc.prepareStatement("SELECT * FROM store_info WHERE store_no = ? or spare_name = ? or spare_no = ? or date= ?");
			dbc.setInt(1,storeno);
			dbc.setString(2,sparename);
			dbc.setInt(3,spareno);
			dbc.setDate(4,date);
			rs = dbc.executeQuery();
			Vector allstoreBO = new Vector();
			while(!rs.next()){
				StoreBO storeBO = new StoreBO();
				storeBO.setStore_no(rs.getInt("stor_no"));
				storeBO.setSpare_name(rs.getString("spare_name"));
				storeBO.setSpare_no(rs.getInt("spare_no"));
			int spareno =((StoreForm) form).getSpare_no();
		String sparename = ((StoreForm) form).getSpare_name();
		int storeno = ((StoreForm)form).getStore_no();
		Date date = ((StoreForm)form).getDate();	
				
				
			}
		}catch(Exception e){
			return mapping.findForward("error1");
		}finally{
			try{
				dbc.close();
			}catch(Exception e){
				e.printStackTrace();
			}
		}*/
		Integer spareno =((StoreForm) form).getSpare_no();
		String sparename = ((StoreForm) form).getSpare_name();
		Integer storeno = ((StoreForm)form).getStore_no();
		Date date = ((StoreForm)form).getDate();
		String strSql = new String("select * from storeinfo where");
		if(!spareno.equals(""))
			strSql = strSql + "spqre_no like'"+spareno+"%'and";
		if(!sparename.equals(""))
			strSql = strSql + "spqre_name like'"+sparename+"%'and";
		if(!storeno.equals(""))
			strSql = strSql + "store_no like'"+storeno+"%'and";
		if(!date.equals(""))
			strSql = strSql + "date like'"+storeno+"%'";
		HttpSession session = request.getSession();
		session.getAttribute(strSql);
		return mapping.findForward("success");
	} 
}

⌨️ 快捷键说明

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