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

📄 cservlet.java

📁 fahirjgjkdfjkl 丰卡时间阿科技安分 发 啊啊啊啊啊
💻 JAVA
字号:
package com.bookshop.web.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.bookshop.web.action.LeftAction;
import com.bookshop.web.action.LoginAction;
import com.bookshop.web.action.RegisterAction;
import com.bookshop.web.action.StudentAction;
import com.bookshop.web.action.factory.ActionFactory;



/**
 * @author ������
 *
 */
public class CServlet extends HttpServlet {

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		    processRequest(request,response);
	}
	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		processRequest(request,response);
	}
	private void processRequest(HttpServletRequest request, HttpServletResponse response) 
	        throws ServletException, IOException {
		    String uri=request.getRequestURI();
		    //System.out.println("-------uri="+uri+"-------");
		    //System.out.println("-------request.getServletPath()="+request.getServletPath()+"-------");
		    String path=uri.substring(9,uri.length()-3);
		    System.out.println("-------path="+path+"-------");
/**
		    if(path.equals("/login")){
		    	LoginAction login=ActionFactory.getLoginActionInstance();
		    	login.execute(request,response);
		    }else if(path.equals("/logout")){
		    	LogoutAction logout=ActionFactory.getLogoutActionInstance();
		    	logout.execute(request,response);
		    }else if(path.equals("/studentAdd")){
		    	StudentAction student=ActionFactory.getStudentActionInstance();
		    	student.execute(request,response);
		    }else if(path.equals("/departAdd")){
		    	DepartAction depart=ActionFactory.getDepartActionInstance();
		    	depart.execute(request,response);
		    }else if(path.equals("/specialtyAdd")){
		    	SpecialtyAction specialty=ActionFactory.getSpecialtyActionInstance();
		    	specialty.execute(request,response);
		    }else if(path.equals("/classAdd")){
		    	ClassAction classAction=ActionFactory.getClassActionInstance();
		    	classAction.execute(request,response);
		    }else if(path.equals("/AjaxTest")){
		    	AjaxTestAction ajaxTest=ActionFactory.getAjaxTestActionInstance();
		    	ajaxTest.execute(request,response);
		    }else if(path.equals("/updatePw")){
		    	UpdatePwAction updatePwAction=ActionFactory.getUpdatePwActionInstance();
		    	updatePwAction.execute(request,response);
		    }
**/		    
		    if(path.equals("/Login")){
		    	LoginAction login=ActionFactory.getLoginActionInstance();
		    	login.execute(request,response);
		    }else if(path.equals("/PageShow")){
		    	StudentAction student=ActionFactory.getStudentActionInstance();
		    	student.execute(request,response);
		    }else if(path.equals("/Register")){
		    	RegisterAction registerAction=ActionFactory.getRegisterActionInstance();
		    	registerAction.execute(request,response);
		    }else if(path.equals("/Left")){
		    	LeftAction leftAction=ActionFactory.getLeftActionInstance();
		    	leftAction.execute(request,response);
		    }    
		    
		    
		    
		    
	}

}

⌨️ 快捷键说明

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