Netbeans 如何在<;中设置会话超时;glassfish web应用程序>;/glassfish-web.xml配置文件?

Netbeans 如何在<;中设置会话超时;glassfish web应用程序>;/glassfish-web.xml配置文件?,netbeans,glassfish-3,glassfish-4,Netbeans,Glassfish 3,Glassfish 4,我试图在/glassfishweb.xml配置文件中设置会话超时,但它不起作用(使用glassfish4和NetBeans): /某条路 保留生成的servlet类的java代码的副本。 10 index.jsp 但如果我像下面这样创建./WEB-INF/WEB.xml文件,一切都会正常工作: <?xml version="1.0" encoding="UTF-8"?> <web-app version="3.1" xmlns="http://xmlns.

我试图在
/
glassfishweb.xml
配置文件中设置会话超时,但它不起作用(使用glassfish4和NetBeans):


/某条路
保留生成的servlet类的java代码的副本。
10
index.jsp
但如果我像下面这样创建./WEB-INF/WEB.xml文件,一切都会正常工作:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1"
         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_3_1.xsd">

    <session-config>
        <session-timeout>10</session-timeout>
    </session-config>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

</web-app>

10
index.jsp
所以,有两个配置文件:
glassfishweb.xml
web.xml
。我能在一个
glassfish web.xml
文件中完成所有这些吗?

找到了解决方案:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">

    <context-root>/some-path</context-root>

    <class-loader delegate="true"/>

    <jsp-config>
        <property name="keepgenerated" value="true">
            <description>Keep a copy of the generated servlet class' java code.</description>
        </property>
    </jsp-config>

    <session-config>
        <session-properties>
            <property name="timeoutSeconds" value="600"/>
            <property name="enableCookies" value="false"/>
        </session-properties>
    </session-config>

</glassfish-web-app>

/某条路
保留生成的servlet类的java代码的副本。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">

    <context-root>/some-path</context-root>

    <class-loader delegate="true"/>

    <jsp-config>
        <property name="keepgenerated" value="true">
            <description>Keep a copy of the generated servlet class' java code.</description>
        </property>
    </jsp-config>

    <session-config>
        <session-properties>
            <property name="timeoutSeconds" value="600"/>
            <property name="enableCookies" value="false"/>
        </session-properties>
    </session-config>

</glassfish-web-app>