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

📄 carmark_plugin.java

📁 hibernate+spring+ext2.0 的物流网站
💻 JAVA
字号:
package com.plugin;

import java.util.Vector;

import javax.servlet.ServletException;

import org.apache.struts.action.ActionServlet;
import org.apache.struts.action.PlugIn;
import org.apache.struts.config.ModuleConfig;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import com.service.CarmackBusinessService;

public class Carmark_PlugIn implements PlugIn {

	public void destroy() {
		// TODO Auto-generated method stub

	}

	public void init(ActionServlet servlet, ModuleConfig arg1)
			throws ServletException {
		// TODO Auto-generated method stub
		System.out.println("Carmack插件正在启动中......");

		// 获取Spring容器上下文关系对象
		ApplicationContext ctx = new FileSystemXmlApplicationContext(servlet
				.getServletContext().getRealPath("")
				+ "/WEB-INF/Carmack_Spring.xml");

		//获取Carmack业务服务类
		CarmackBusinessService cbus = (CarmackBusinessService) ctx.getBean("carmackbusinessservice");
		
		//获取车辆型号集合信息
		Vector tmvc = cbus.getTruckmodelbu().findAll();
		System.out.println("车辆型号数据长度:"+tmvc.size());
		
		//将集合信息设置到上下文关系中
		servlet.getServletContext().setAttribute("CarmackTMvc", tmvc);
		
		System.out.println("Carmack插件启动完毕......");
	}

}

⌨️ 快捷键说明

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