当前位置:编程学习 > JS >>

Servlet中怎么取得session和application

import java.io.IOException;
import java.io.PrintWriter;
 
import javax.servlet.ServletContext;//和其它的不在一个包
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
 
 
public class X extends HttpServlet {
 
 
 public void doGet(HttpServletRequest request, HttpServletResponse response)
   throws ServletException, IOException {
            HttpSession session=request.getSession();//得到session
         ServletContext    application =super.getServletContext();//GenericServlet提供的方法,得到application
 }
 
 
补充:Web开发 , Jsp ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,