Servlets 为什么HttpServletRequest对象没有getServletConfig()方法?
我是Java servlet新手,在阅读一篇教程时,我发现了这一点Servlets 为什么HttpServletRequest对象没有getServletConfig()方法?,servlets,jakarta-ee,servletconfig,Servlets,Jakarta Ee,Servletconfig,我是Java servlet新手,在阅读一篇教程时,我发现了这一点 ServletContext context = getServletContext(); 当我尝试使用请求对象获取ServletContext对象时,它也起了作用 ServletContext context = request.getServletContext(); 但是我在HttpServletRequest类中找不到获取ServletConfig的方法 ServletConfig config = request.
ServletContext context = getServletContext();
当我尝试使用请求对象获取ServletContext对象时,它也起了作用
ServletContext context = request.getServletContext();
但是我在HttpServletRequest类中找不到获取ServletConfig的方法
ServletConfig config = request.getServletConfig();
这是不正确的,因为HttpServletRequest
类没有getServletCofig()
方法
为什么会这样?
我知道ServletConfig充当servlet的本地,而ServletContext充当应用程序中所有servlet的全局。这跟这有什么关系吗
谢谢你的帮助。它在屏幕上。@NikosParaskevopoulos我想知道它为什么不在屏幕上。