PDA

View Full Version : Preventing JSP from creating session


laguz
Apr 26th, 2006, 04:05 AM
Hi all,

lately I realized that every request to a jsp causes the creation of a new session if no one exists. As I would like to manage sessions in a different way I am searching for a possibility to avoid that without adding session="false" to every jsp.

Does spring support something like that?

Thanks!

Colin Yates
Apr 26th, 2006, 04:33 AM
The servlet spec allows you to specify a jsp that is automatically included in every other jsp. Simply set session="false" in the included jsp.

Incidently, I also put all the import into that included jsp as well ;)


<jsp-property-group>
<description>JSP configuration of all the JSP's under /jsps-one/ folder</description>
<url-pattern>/jsps-one/*.jsp</url-pattern>
<include-prelude>/common-jsps/prelude1.jspf</include-prelude>
<include-coda>/common-jsps/coda1.jspf</include-coda>
</jsp-property-group>
<jsp-property-group>
<description>JSP configuration of all the JSP's under /jsps-two/ folder</description>
<url-pattern>/jsps-two/*.jsp</url-pattern>
<include-prelude>/common-jsps/prelude2.jspf</include-prelude>
<include-coda>/common-jsps/coda2.jspf</include-coda>
</jsp-property-group>

laguz
Apr 26th, 2006, 05:07 AM
works fine - thanks!