---
title: "request.getSession()/request.getSession(true)和request.getSession(false)的区别"
author: "axindao"
date: "2014-04-27T18:55:00Z"
tags: []
categories: ["Web前端"]
slug: "request-getsession-request-getsession-true-request-getsession-false"
draft: false
lastmod: "2014-04-27T18:55:00Z"
id: 2055879
url: "https://axindao.iteye.com/blog/2055879"
---

request.getSession()/request.getSession(true)和request.getSession(false)的区别

request.getSession()等同于request.getSession(true)：若存在会话则返回该会话，否则新建一个会话。  
request.getSession(false)：若存在会话则返回该会话，否则返回NULL