首页>代码>基于jsp+servlet的idea版学生管理系统,前端框架layui>/studentManage/源码/studentManage/src/main/java/controller/BaseServlet.java
package controller;

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 java.io.IOException;
import java.lang.reflect.Method;

@WebServlet(name = "BaseServlet")
public class BaseServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8");
        resp.setCharacterEncoding("UTF-8");
        String method = req.getParameter("method");
        if (method != null) {
            try {
                Method targetMethod = this.getClass().getMethod(method, HttpServletRequest.class, HttpServletResponse.class);
                targetMethod.invoke(this, req, resp);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
最近下载更多
ZzzxzzZ  LV6 前天
zhaipengfei  LV2 3月3日
ma406805131  LV19 2024年12月27日
120_wu  LV4 2024年12月2日
李清清  LV2 2024年11月6日
xiao小果  LV13 2024年8月19日
破剑茶寮  LV4 2024年6月26日
15719908287  LV9 2024年6月19日
TY0165  LV20 2024年6月18日
微信网友_7024879466991616  LV2 2024年6月14日
最近浏览更多
ZzzxzzZ  LV6 前天
zhaipengfei  LV2 3月3日
暂无贡献等级
kkkxyh  LV13 2月11日
dongandmin  LV8 2024年12月27日
ma406805131  LV19 2024年12月26日
120_wu  LV4 2024年12月2日
haomc052829  LV4 2024年11月18日
李清清  LV2 2024年11月6日
yimaoermao  LV1 2024年9月14日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友