首页>代码>jsp+servlet开发java web在线租车服务系统>/opencar/src/com/weishang/my/action/EnterpriseService.java
package com.weishang.my.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.weishang.pojo.Recept;
import com.weishang.service.UserService;
import com.weishang.tool.ReturnJspUrl;
@WebServlet(displayName="企业服务",name="EnterpriseService",urlPatterns="/service")
public class EnterpriseService extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public EnterpriseService() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	/**
	 * 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 {
		UserService us=new UserService();
		ReturnJspUrl rj=new ReturnJspUrl();
		String menuId=request.getParameter("menuId");//获取菜单id
		Recept recept=null;
		String jsp="";
		try {
			recept=us.getReceptById(menuId);
			request.setAttribute("recept",recept);
			request.setAttribute("menuId",menuId);
			jsp=rj.url(request, "/page/"+recept.getJspMod()+".jsp");
			RequestDispatcher rd = request.getRequestDispatcher(jsp);
			rd.forward(request,response);
		} catch (NumberFormatException e) {
			jsp= "/404.jsp";//前台的手机jsp页面
			RequestDispatcher rd = request.getRequestDispatcher(jsp);
			rd.forward(request,response);
		}catch (SQLException e) {
			jsp= "/404.jsp";//前台的手机jsp页面
			RequestDispatcher rd = request.getRequestDispatcher(jsp);
			rd.forward(request,response);
		}catch (NullPointerException e) {
			jsp= "/404.jsp";//前台的手机jsp页面
			RequestDispatcher rd = request.getRequestDispatcher(jsp);
			rd.forward(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 {
		doGet( request,  response);
	}

	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occurs
	 */
	public void init() throws ServletException {
		// Put your code here
	}

}
最近下载更多
柳咪华沙  LV7 2024年6月28日
fei3655  LV6 2022年9月20日
admin115  LV6 2022年5月24日
monan111  LV2 2022年3月2日
duizhang  LV5 2022年2月19日
houliukou  LV38 2022年1月18日
I哎I呀I呀I  LV3 2021年11月22日
开心阿楠  LV5 2021年9月18日
zwbshuai  LV13 2021年8月26日
newbag  LV9 2021年8月9日
最近浏览更多
小松哥11  LV3 2024年10月24日
张泽帅  LV6 2024年10月21日
柳咪华沙  LV7 2024年6月28日
yunsgui  LV1 2024年6月26日
lmccccc 2024年6月19日
暂无贡献等级
hebao007 2024年5月22日
暂无贡献等级
fuyouou  LV5 2024年3月14日
pumpkin_77 2024年1月20日
暂无贡献等级
axdfer 2024年1月4日
暂无贡献等级
asddwh  LV13 2023年12月26日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友