aspose file tools*
The moose likes JForum and the fly likes how do you check if the user is logged in or not Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » JForum
Bookmark "how do you check if the user is logged in or not" Watch "how do you check if the user is logged in or not" New topic
Author

how do you check if the user is logged in or not

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hello everyone.....

Can anybody tell me how to check a user, if he is logged in or not.

I require this for my new page created in jsp.
If he is not logged in then i need to ask him to log in.


[originally posted on jforum.net by blutopaz_stein]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
If the user is logged in, the a call to



should return the string "1"

More information you can get by getting the UserSession instance that is in every session:



Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
can u clarify the first method
[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
What?

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Nice

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Thank u rafael it worked.


[originally posted on jforum.net by blutopaz_stein]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Rafael,
this is useful for me too. Thanks.

As a follow up, I have a Java webapp where users have to log in. I'm hoping to use JForum as an add on to this, but I don't want users to have to log in twice. I could use the JForum "users" table as the master users table (ie. migrate my existing users table), but what do I need to set in the session to fool JForum into thinking that the user has also logged into JForum? What attributes does your "UserSession" have? Is that the best way of doing this, or do you have any other suggestions?

thank for any tips.
Jim.

[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Take a look in the method "checkCookies()", from JForum.java

Rafael
[originally posted on jforum.net by Rafael Steil]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how do you check if the user is logged in or not