struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John O'Hanley" <>
Subject Templates and session cookies
Date Thu, 14 Feb 2002 20:44:56 GMT
Hi folks,

I am encountering unexpected session behaviour when I use templates: the
web container (Tomcat 3.2.3) does not seem to send a session-cookie to
the browser.

When I do not use templates, the session behaviour is as expected: the
first page has re-written URLs, and the second does not, since the
browser and Tomcat have done a handshake with a session-cookie. I don't
understand. How could use of the template mechanism stomp on the cookies
already placed in the http header?

 - John

The first line of the controller servlet is always:
      HttpSession session = aRequest.getSession();

The template.jsp file itself contains
<%@ page language="java" contentType="text/html" %>
<%@ taglib uri="/struts-template" prefix="template" %>
<%@ taglib uri="/struts-html" prefix="html" %>
<%@ page import="javapractices.*" %>

<%-- Use a pre-existing bean for User information --%>
<jsp:useBean id="userData" scope="session" type="myapp.User" />
<%-- Build a bean for localizing text --%>
<jsp:useBean id="text" scope="request" class="myapp.UiText" >
 <jsp:setProperty name="text" property="language" value='<%=
userData.getLanguage() %>' />

   <%= text.getLocalText(Text.CompendiumOfJavaPractices)%>

 <body text="blue" bgcolor="red">
 <basefont size=3>

 <table width="85%" align="CENTER" bgcolor="WHITE" border=0

  <%-- a navigation bar --%>
  <tr bgcolor=#003399>
     <td align=center>
      <font color=white>
       <%-- a list of navigation links  --%>
       <%-- a search box --%>


<table width="85%" align="CENTER" bgcolor="WHITE" border=0

 <%--Content goes here
 Note that the flush=true is required, or else the
 order of stuff gets mixed up--%>
<template:get name="content" flush="true"/>

 <%-- Footer --%>
The user of the template is:

<%@ taglib uri="/struts-template" prefix="template" %>

<template:insert template="Template.jsp">
  <template:put name="content" content="TableOfContentsBody.jsp"/>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message