File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes pass the session variable to 2 jsp simultaneously Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "pass the session variable to 2 jsp simultaneously " Watch "pass the session variable to 2 jsp simultaneously " New topic
Author

pass the session variable to 2 jsp simultaneously

zheng yu
Greenhorn

Joined: Apr 25, 2001
Posts: 28
I have 1 servlet and 2 jsp fils(say a.jsp , b.jsp ) , one jsp( b.jsp) is embeded in the other jsp( a.jsp ) by using <IFRAME > Tag .
After servlet has finished its job ( save results as session variable ) , it use getRequestDispatch("a.jsp" ).forward(req,res ) to redirect the request to a.jsp . Does both a.jsp and b.jsp can access the same session variables ?
My situation is a.jsp can retrieve the session variable , b.jsp can access too , but it seems that data is corrupted ( In my situation , my session variable is a byte[] )
Thanks
ZY
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12268
    
    1
Your two jsp can certainly share a session, but since you can't control the order in which the request threads run, you will need to synchronize access to any variables that might be changed.
Bill
------------------
author of:


Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: pass the session variable to 2 jsp simultaneously
 
Similar Threads
How can I access JSP variable value in one jsp from adifferent jsp file
Problem caused by pressing the 'BACK' button on the broswer
Changing the URL when using forward or redirect...
Mapping JSP
Difference JSP File & JSP Page