This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to detect first time login to the web application
 
Similar Threads
why security constraints does apply?
Windows Xp LogIN and LogOut detection
Windows Xp LogIN and LogOut detection
Windows Xp LogIN and LogOut detection
Detect overloaded web, application or database server