• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

lost session attribute on src JSP's

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I have been wrestling with this subtle one for most of today...
I have a JSP that includes a couple of other JSP's, so that my servlet can always post to the same JSP and dynamically include a header and the body. Eg Main.jsp
<html>
<head>
</head>
<body>
<frameset cols='230,*' border='0' framespacing='0'
frameborder='NO'><frame src='header.jsp' name='header'><frame
src=body.jsp' name='body'></frameset>
</body>
</html>
My problem is that I need to extract a class that I populate with all the necessary data from the session implicit object in the two included JSP pages. The implicit session object in Main.jsp contains the class I need to extract, but neither header.jsp or body.jsp can get to that class. I have checked this in the two included JSP's by outputing the value of all the session object values by extracting them using session.getValueNames and writing these out. It contains nothing.
I have checked that the object I am trying to extract has session scope, because I can see it in Main.jsp.
This has me stumped. I am using Tomcat 3.2.3
Please help me.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are all of these pages in an application that has been set up in the server.xml file?
If it was me, I would try using URLs for the pages that include the application root.
/myapp/main.jsp
/myapp/body.jsp
/myapp/header.jsp
Bill
------------------
author of:
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you testing with cookies enabled in your browser? If not, then you should encodeURL the two src values.
------------------
Miftah Khan
- Sun Certified Programmer for the Java 2 Platform
- Sun Certified Web Component Developer for the J2EE Platform
 
James Inge
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thankyou for your replies.
I added the full path to the JSP references, but still no joy. I also used encodeURL to add the session reference, but the session is gone when I check it in header and body JSP's. I think that the session has been invalidated and thus cleared.
I have gotten a bit further on where my problem is, but still can't work it out.
If I use the jsp:include tag to add my header and body in my page then I have no problems with my session object. But using the src attribute of frame is where the session object goes missing.
Do you think I have a Tomcat configuration problem?
 
reply
    Bookmark Topic Watch Topic
  • New Topic