首页>代码>jsp显示java后台的异常>/error/src/servlet/ErrorServlet.java
package servlet;

import java.io.IOException;
import java.io.PrintWriter;

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

public class ErrorServlet 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 {
		doPost(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 {
			int i=0/0;
			request.setAttribute("message", i);
			request.getRequestDispatcher("/error.jsp").forward(request, response);
	}

}
最近下载更多
雨后的太阳  LV1 2022年8月17日
zyl  LV34 2015年9月16日
mothra  LV2 2015年9月7日
ws04152  LV40 2014年7月2日
风铃  LV32 2013年11月21日
矿泉水  LV30 2013年11月15日
最代码官方  LV167 2013年11月13日
最近浏览更多
微信网友_6206233028890624  LV2 2022年11月10日
雨后的太阳  LV1 2022年8月17日
不良猫  LV3 2022年5月15日
晚春的树和书  LV6 2021年5月6日
qjycbwtsj  LV3 2020年12月8日
黑暗逝去  LV1 2020年5月20日
jackwong  LV7 2020年4月22日
啊撒大网的人权为荣  LV2 2020年1月7日
2493105950  LV2 2019年12月30日
s222222  LV4 2019年4月16日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友