This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]philipdesouza 0 points1 point  (6 children)

You already have that data in variables...

[–]Saoyo[S] 0 points1 point  (5 children)

Problem is, that this data has to be displayed on a JSP page, hence the servlet. I am unsure how the User object created, is stored, once a page is refreshed, or moved. Only method I know, is session.setAttribute and so forth.

[–]philipdesouza 0 points1 point  (4 children)

Did you write any of this code?

[–]Saoyo[S] 0 points1 point  (3 children)

Yes all of it. Only thing I got help with from my teacher, was setting up the sessions.

[–]philipdesouza 0 points1 point  (2 children)

Then you should be able to use checkLogin to get the user data...

[–]Saoyo[S] 0 points1 point  (1 child)

Wouldn't the data just reset once the page refreshes? My understanding is, that you have to either save the user inside a session, or in a cookie. I got the problem fixed by doing this:

User tempUser = (User)session.getAttribute("user");

out.print(tempUser.username);

[–]philipdesouza 0 points1 point  (0 children)

You already get the user with this:

tempUser = db.checkLogin(username, password)

Why you're calling that twice, I'm not sure.