我写了一小段代码来理解会话......这是代码
public class SessionServlet extends HttpServlet
{
public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException
{
PrintWriter out=response.getWriter();
HttpSession session=request.getSession();
if(session.isNew())
{
out.println("Client has not responded");
}
else out.println("Client has responded");
}
}
以我的理解,在第一次运行我的程序时,它应该“客户没有响应”,但是它打印了第一条语句......可以解释为什么它会这样做。