|
||||||
| 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. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
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");
}
}
}
|
| Sponsored Links |
|
|
|
|||
|
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.
|
|
|||
|
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. |
|
|||
|
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.
|
| Sponsored Links |
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
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 |
| John | ........ | 223.00000 |
| dargueta | ........ | 168.00000 |
| Xav | ........ | 164.00000 |
| gaylo565 | ........ | 18.00000 |
| WingedPanther | ........ | 15.00000 |
| |pH| | ........ | 15.00000 |
| Johnnyboy | ........ | 3.00000 |
| navghost | ........ | 1.00000 |
Goal: 100,000 Posts
Complete: 65%