Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

JSP Sessions

Options
  • 23-03-2006 8:31pm
    #1
    Registered Users Posts: 1,987 ✭✭✭


    I seem to be losing a value thats stored in a session variable while moving to a certain page, the register page and the login page both go to the user page while on the user page the username variable from the session always returns null!

    this is the code on the top of the user page:
    <%@page import="java.util.*" session="true"%>
    <%
      String username=(String) session.getAttribute("username");
      if(username=="") username=null;
    %>
    

    this is the code in the main body of the page:
    <%= username %>
    <%= user.name(username) %>
    


Comments

  • Moderators, Politics Moderators Posts: 39,929 Mod ✭✭✭✭Seth Brundle


    change
    if(username=="") username=null;
    to
    if(username.equals"") username=null;


Advertisement