checi_updateaction.java

来自「java做的 公交车查询系统....毕业设计」· Java 代码 · 共 50 行

JAVA
50
字号
//在checi.jsp页面中,进行显示与更新的处理动作
package gongjiaochexitong.gongjiaoche.checi_pkg;

import gongjiaochexitong.gongjiaoche.*;
import gongjiaochexitong.gongjiaoche.main_pkg.*;

import java.util.Vector;

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 javax.servlet.ServletContext;
import javax.sql.DataSource;

public final class checi_updateAction extends Action{
	
	public ActionForward execute(
			ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,  
			HttpServletResponse response) throws Exception {			  
			
	  ServletContext context = servlet.getServletContext();
	  DataSource dataSource = (DataSource)context.getAttribute("db_gongjiaoche");
	  conn_Bus db = new conn_Bus(dataSource);	  
	
	  HttpSession session = request.getSession();	  
	  
	  //重复checi_Action.java中的动作,重新查询数据库,获取数据,并加载
	  try {
			Vector checi_list=procedure.getCheCi_List(db);   //这里的站点是站点号,须转换
			session.setAttribute(constants.CHECI_LIST_KEY2,checi_procedure.stationNo2stationName(db,checi_list));
		} catch (Exception e) {
			//System.out.println("出现异常:"+e);
			e.printStackTrace();				
	  }
	  
	  db.conn_Close();     //close connection
	  return mapping.findForward("tocheci");
			
	}

}

⌨️ 快捷键说明

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