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

📄 bitscontroller.java

📁 一个自制的DB framework,使用的配置方式新颖
💻 JAVA
字号:
package bits;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.sql.*;

public class BitsController extends HttpServlet {
	private static final String CONTENT_TYPE = "text/html; charset=GBK";
	private String strQueryPath;
	private String strConfigPath;
	private ServletContext context;

	public void init() throws ServletException {
		ServletConfig config = this.getServletConfig();
		context = config.getServletContext();
		strQueryPath = context.getRealPath("/conf/query.xml");
		strConfigPath = context.getRealPath("/conf/appconfig.xml");
		context.log(strConfigPath);
	}

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		try {
			request.setCharacterEncoding("GBK");
			int protocolID = Integer.parseInt(request.getParameter("a"));
			DBconnection conn = new DBconnection();
			conn.DBInit(this.strConfigPath);
			config config = new config(strQueryPath);
			actionitem strs = config.searchSQL(protocolID, request);
			IHandle handler = HandlerFactory.getHandler(strs.handlerid);
			handler.handle(conn, strs.strsql, request);
			request.getRequestDispatcher(strs.strforward).forward(request,
					response);
		} catch (Exception ex) {
			throw new ServletException(ex);
		}
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
	}
}

⌨️ 快捷键说明

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