• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

After logout application is opened using jsp

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am developing one application using JSP and Spring. In this application,after click on 'Logout' it is redicted Login page.

Suppose this application URL is in following manner.
http://localhost:8080/test

After Logout the application,suppose I want to give following URL without giving any credentails.
http://localhost:8080/test/example.jsp

After this,application is opened.

I want to restrict this.How ?
thanks in advance

 
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Suppose this application URL is in following manner.
http://localhost:8080/test

After Logout the application,suppose I want to give following URL without giving any credentails.
http://localhost:8080/test/example.jsp



It's not quite clear what you are asking for. But if it's about redirection at the time of logout, you can use sendRedirect() method of the response object to point you to the required page , in your case "example.jsp". Also if you want to stay on this page for some duration and then redirect , then you can use javascript to redirect you after some interval

Regards,
Vishal.
 
srinivas mallabathula
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After Logout the application,
If I give
http://localhost:8080/test/example.jsp
URL in browser address bar it can open the application.
But it has to remain in login page till enter credentials and press login button.

please follow attachments
1.png
[Thumbnail for 1.png]
Login screen
2.png
[Thumbnail for 2.png]
unauthorised URL enter in address bar
3.png
[Thumbnail for 3.png]
 
Vishal Shaw
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

You can do 1 thing. When you validate the user's login credentials, you put some data in session. Then in your jsp pages you check for that session variable, if that variable is not present you simply redirect it to the login page with some message. Thus the user will be restricted to opening any page without login . Also don't forget to invalidate() your session on logout.

I hope this is what you are looking for.

Regards,
Vishal
 
Vishal Shaw
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

You can do 1 thing. When you validate the user's login credentials, you put some data in session. Then in your jsp pages you check for that session variable, if that variable is not present you simply redirect it to the login page with some message. Thus the user will be restricted to opening any page without login . Also don't forget to invalidate() your session on logout.

I hope this is what you are looking for.

Regards,
Vishal
 
Ranch Hand
Posts: 384
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
all you need is to invalidate your session for the logged in user when he does a logout. :-)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic