coding_idiot
coding_idiot

Reputation: 13734

Struts2 remember me

I'm using Struts 2 in my web application. My client is asking me to implement "Remember Me" feature, so that he doesn't have to login again. This is what I think should be done:

  1. I should create a cookie with some user-specific key and store the same in database on user login if "Remember me" option is checked.
  2. I should write an interceptor, that takes out cookies from the request, checks the key against the database and if found and not expired (7 days), it puts the corresponding user in session.

Is there any other, more effective & easy & better, performance-wise method?

Upvotes: 2

Views: 1551

Answers (1)

DarkHorse
DarkHorse

Reputation: 2770

Your approach is correct and this link will help you to implement it in a more effective way :)

Upvotes: 2

Related Questions