源码视图下,编辑 src/main/webapp/WEB-INF/web.xml
文件,配置 session-config
段
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<session-config>
<cookie-config>
<name>PHPSESSIONID</name>
</cookie-config>
</session-config>
</web-app>
例如上面的配置文件中,我们将其默认的 Session Cookie Name 从 JSESSIONID
修改成了 PHPSESSIONID
。