资源简介
Java基础学习必备包之一,便于学习中开发使用,开发servlet必备包,
代码片段和文件信息
package cn.com.utils;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public abstract class baseServlet extends HttpServlet {
public void service(HttpServletRequest request HttpServletResponse response) throws ServletException IOException {
response.setContentType(“test/html;charset=utf-8“);
request.setCharacterEncoding(“utf-8“);
String methodName=request.getParameter(“method“);
Method m=null;
try {
m=this.getClass().getMethod(methodName HttpServletRequest.classHttpServletResponse.class);
} catch (NoSuchMethodExcept
评论
共有 条评论