Lost Password?

Go Back   CodeCall Programming Forum > Software Development > Java Help

Java Help Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-18-2008, 11:49 PM
karan_736 karan_736 is offline
Newbie
 
Join Date: Jan 2008
Posts: 3
Rep Power: 0
karan_736 is on a distinguished road
Default session creation failing in IE

i have a small application which checks for username and
password and forwards the users to
restricted pages on confirmation. i ve uploaded the application on eatj.com for testing, now my problem is that
the session creation code is not working in Internet Explorer.means every time i refresh the page or go to some
other page, session id changes. But it is working perfect in other (Firefox, opera and netscape ) browsers. my
cookies are enabled and the code is working fine in my
development machine with I E. More over i ve tested this program on atleast 10 different machines with the same results so cookies being turned off is out of question. Any guesses what cud be wrong. cud it be some problem
in the eatj.com site.
here is my code

Code:
public class Login extends HttpServlet
{

	public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
	{
		String username = request.getParameter("username");
		String password = request.getParameter("password");
		if(username.equals("admin")&&password.equals("admin"))
		{
			HttpSession session = request.getSession();
			System.out.println("session id "+session.getId());
			session.setAttribute("username", username);
			RequestDispatcher dispatch = request.getRequestDispatcher("Welcome.jsp");
			dispatch.forward(request, response);			
		}
		else
		{
			response.sendRedirect("index.jsp");
		}
	}

}
It just checks for the hardcoded username and password and forwards the 'admin' user to welcome.jsp page where i am printing the session id and the username with welcome message. That id stays same for all the browsers except Internet Explorer, as when i refresh the page in IE i get a new session id.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 01-22-2008, 01:19 PM
Arkie Arkie is offline
Learning Programmer
 
Join Date: Dec 2007
Posts: 81
Rep Power: 3
Arkie is on a distinguished road
Send a message via MSN to Arkie
Default

If you've tested this on 10 different machines with the same results did you ever think it could be because if IE?
__________________
My personal Java blog with open source software
My open source messenger!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-23-2008, 02:06 AM
karan_736 karan_736 is offline
Newbie
 
Join Date: Jan 2008
Posts: 3
Rep Power: 0
karan_736 is on a distinguished road
Default

Quote:
Originally Posted by Arkie View Post
If you've tested this on 10 different machines with the same results did you ever think it could be because if IE?
It is dear. it is because of IE. but my question is why? this is a very simple program, am not using any plug in etc, so this is just a simple case of accepting cookies and creating a session, as all the other browsers are doing, But not the IE. why IE is not accepting cookies from the eatj.com. I ve tried to put the site in the trusted sites area of my IE, but no effect.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-25-2008, 08:07 PM
bcoe bcoe is offline
Newbie
 
Join Date: Jan 2008
Posts: 4
Rep Power: 0
bcoe is on a distinguished road
Default Sessions in IE

I've had trouble with sessions in servelets,

I would recommend using cookies instead, I know for a fact this will work in IE, Firefox and any other major browser -- a user pretty much expects to get cookies from most websites nowadays, so I don't really think there is the stigma attached to them that there once was...

Let me know if you want any sample code

Cheers,

Ben.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-25-2008, 10:50 PM
karan_736 karan_736 is offline
Newbie
 
Join Date: Jan 2008
Posts: 3
Rep Power: 0
karan_736 is on a distinguished road
Default

bcoe , thanks for reply. I think by default session handling in servlet api is done through cookies only, if cookies are disabled only then url rewriting comes to play. But the thing here is that IE is not accepting cookies from that particular site, even if i am managing my cookies manually, means i am writing my own cookies and setting those in the response. this is the most weired thing i ve seen.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Protection JPEG/DIR with session elle PHP Forum 4 07-22-2007 02:14 PM
object in session.... "<logic:present>" with JSTL? reachpradeep Java Help 0 03-04-2007 08:46 AM
Crossword program creation tristan999 General Programming 0 12-21-2006 06:22 AM
A simple SUDOKU creation v1.0 Kernel Software Development Tools 0 10-02-2006 03:10 AM
DBMS, SQL Interface Creation in C++ v1.0 Kernel Software Development Tools 0 10-02-2006 03:10 AM


All times are GMT -5. The time now is 04:11 PM.

Contest Stats

John ........ 223.00000
dargueta ........ 168.00000
Xav ........ 164.00000
gaylo565 ........ 18.00000
WingedPanther ........ 15.00000
|pH| ........ 15.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 65%

Ads