Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: HOW TO REDIRECT TO LOGIN PAGE IF NOT LOGGED IN

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default HOW TO REDIRECT TO LOGIN PAGE IF NOT LOGGED IN

    HI,

    my tomcat web application is working perfectly and it have only javascript and jsp pages.. but the problem is if user types any url of any particular jsp page in tomacat server its displaying that page..so please help me how to redirect to login page if user user types url.. he should login first before opening any pages............ please help me for this.


  2. #2
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: HOW TO REDIRECT TO LOGIN PAGE IF NOT LOGGED IN

    Do you know the concept of session and cookies? If no, go on and read.

  3. #3
    Junior Member
    Join Date
    Mar 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: HOW TO REDIRECT TO LOGIN PAGE IF NOT LOGGED IN

    Thank u for your reply....

    yes i saw the concept of session and cookies. but wherever i saw i'm finding sessions for login and logout but session for login and logout is perfectly working in my app.. and i'm thinking that session should be placed in each and every jsp right?... but i'm unable to find the code for this and if i found also not knowing were to keep that code in every jsp... please help me if you have any idea... if you have reference material on regarding this also then please link here .......... i'l refer...

  4. #4
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: HOW TO REDIRECT TO LOGIN PAGE IF NOT LOGGED IN

    Before redirecting the user to any page, just check if session is not null.

Similar Threads

  1. Need help in login page in struts
    By vinothkumarrvk in forum Web Frameworks
    Replies: 4
    Last Post: October 4th, 2011, 02:10 PM
  2. Login Page error
    By abhiM in forum What's Wrong With My Code?
    Replies: 7
    Last Post: August 23rd, 2011, 07:30 AM
  3. Unable to view jsp pages through same login page
    By Rajiv in forum Web Frameworks
    Replies: 1
    Last Post: August 17th, 2011, 11:43 AM
  4. Replies: 1
    Last Post: August 12th, 2011, 10:09 AM
  5. login page with image
    By balu424525 in forum AWT / Java Swing
    Replies: 1
    Last Post: June 26th, 2011, 11:24 AM