Solved

Session problem for browser Opera

Posted on 2004-09-30
3
825 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
xjc and jaxb 2 88
getting param value 7 51
lessBy10  challenge 15 89
struts spring hibernate example 12 86
A Short Story about the Best File Recovery Software – Acronis True Image 2017
For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now