struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John O'Hanley" <johan...@capitalnet.com>
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() %>' />
</jsp:useBean>

 <html>
 <head>
  <title>
   <%= text.getLocalText(Text.CompendiumOfJavaPractices)%>
  </title>
 </head>

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

 <table width="85%" align="CENTER" bgcolor="WHITE" border=0
CELLSPACING="0" CELLPADDING="3">

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

</table>

<table width="85%" align="CENTER" bgcolor="WHITE" border=0
CELLSPACING="0" CELLPADDING="3">

 <%--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 --%>
etc....
///////////////////////////////////
The user of the template is:

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

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




--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message