Solved

Session problem for browser Opera

Posted on 2004-09-30
3
832 Views
Last Modified: 2012-06-27
Hi all,

I have a page (page1.jsp) with codes:

session.setAttribute("session1", "test");
System.out.println("first: "+(String)session.getAttribute("session1"));
response.sendRedirect("page2.jsp");

Codes for page2.jsp:
System.out.println("second: "+(String)session.getAttribute("session1"));

When open page1.jsp on Opera 7.5, the result is:
first: test
second: null

Why is the session lost after redirect the page? Please help me to fix it. Thanks.

0
Comment
Question by:CodeLover
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 50 total points
ID: 12193095
Try:

session.setAttribute("session1", "test");
System.out.println("first: "+(String)session.getAttribute("session1"));
response.sendRedirect( response.encodeRedirectURL( "page2.jsp" ) );

in page1.jsp

Looks like Opera isn't accepting the cookie properly...(do you have cookies turned off?)
0
 

Author Comment

by:CodeLover
ID: 12195133
Thanks. It works when it accepts cookies.
0
 
LVL 35

Expert Comment

by:TimYates
ID: 12195493
:-)

Good luck!!

Tim
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
ConnectWise and their customers need to ensure critical alerts automatically reach the right person at the right time. MSP superheros efficiently respond to these alerts key is providing automatic, intelligent alerting that generates a complete audi…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question