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

📄 frontcontroller.java

📁 本人大学时大型作业用JAVA做的一个 BBS系统 模式MVC 非struts版 开发工具JCreator Pro 数据库SQL2
💻 JAVA
字号:
package servlets;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.IOException;
import javax.xml.parsers.*;
import org.xml.sax.*;
import helps.*;
public class FrontController extends HttpServlet
{	
	private ServletConfig config;
	public void init() throws ServletException
	{
		config=this.getServletConfig();
	}
	protected void processRequest(HttpServletRequest req, HttpServletResponse res)
		throws ServletException, IOException
	{	
		try
		{
			ServletContext scx=config.getServletContext();				
			String path = req.getPathInfo().substring(1);
			Action action = ActionHelper.getAction(scx,path);
			String nextView = action.process(scx,path,req,res);		
			RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(nextView);
			dispatcher.forward(req, res);
		}
		catch(ParserConfigurationException pce)
		{
			pce.printStackTrace();
		}
		catch(SAXException saxe)
		{
			saxe.printStackTrace();
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}		
	}	
	protected void doGet(HttpServletRequest req, HttpServletResponse res)
		throws ServletException, IOException
	{
		this.processRequest(req, res);
	}	
	protected void doPost(HttpServletRequest req, HttpServletResponse res)
		throws ServletException, IOException
	{		
		this.processRequest(req, res);
	}	

	
}

⌨️ 快捷键说明

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