in my application a servlet stores the user's details when she starts
with the application as follows

User user=new User();
HttpSession session=req.getSession();
user.setUser(userName);
user.setRole("user");
session.setAttribute("user", user);
RequestDispatcher rd=req.getRequestDispatcher("/HomePage.jsp");
rd.forward(req, resp);

After this servlet stored the User object in session, every jsp in the
application receives the User object from session using a helper class

public class UserIdentifier
{
public static String getUser(HttpServletRequest req)
{
        HttpSession session=req.getSession(false);
        User userObj=(User)session.getAttribute("user");
        String role=userObj.getRole(); // HERE IS THE ERROR
        String user=null;
        if(role.equals("admin"))
        {
                user=(String)session.getAttribute("user2");
                if(user==null)
                {
                        return null;
                }
        }
        if(role.equals("user"))
        {
                user=userObj.getUser();
        }
        return user;
}
}

The User class is serializable and <sessions-enabled>true</sessions-
enabled> is present in appengine-web.xml

it works fine on my local machine but when i deployed to app engine,
it throws a nullpointer exception on the line where i called
userObj.getRole();
it indicates that userObj is null,  i dont understand why it is not
able to pick the User object from the session


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to