aspose file tools*
The moose likes Struts and the fly likes How to detect first time login to the web application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to detect first time login to the web application" Watch "How to detect first time login to the web application" New topic
Author

How to detect first time login to the web application

deepika mane
Greenhorn

Joined: Jul 15, 2009
Posts: 5
Hi,

I have developed a web application using struts 2 framework . I want to generate a password automatically on first time log in to the application and send a notification mail with new password and a link to change that password. How to detect the first time log in of the user?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Store a flag with the user. Or have a last login date field that isn't filled until they've logged in. Or check for a cookie (only works if cookies are enabled).

In any case, this has nothing to do with JSP; I'll move to... um... Struts, since you're using Struts, although there's nothing Struts-specific, either.
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

You can check if there is a session. You can check if it's new and if returns true, you got you first time visitor.

http://download-llnw.oracle.com/javaee/1.2.1/api/javax/servlet/http/HttpSession.html#isNew%28%29

Be aware that cookies should be enabled.


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
deepika mane
Greenhorn

Joined: Jul 15, 2009
Posts: 5
Hiii,

Thanks for your reply
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to detect first time login to the web application