This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transfer the control to login page.

 
arvind kushwaha
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Team,

I have a requirement whenever user wants to view any other jsp page except login page the control should be transfer to login page. How should i achieve it .

Thanks and Regards
Arvind
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So no one can ever see any other page? Sounds easy; jut have one page.

Or do you mean prior to authentication? (If so, be explicit). In that case, a filter that checks for authentication is the way to go.
 
arvind kushwaha
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Bear Bibeault,


I need to check prior to authentication. For Example suppose i had enter the gmail inbox url without providing authentication. So in that case login page is shown to me, not the gmail inbox url .

Same way i want in my project. I have no idea how to do that...Please suggest me or provide some example.


Thanks and regards
Arvind Kushwaha
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use Servlet Filters.

Please refer below link

Securing J2EE Applications with a Servlet Filter
 
Junilu Lacar
Bartender
Posts: 7466
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
arvind kushwaha wrote:I have no idea how to do that...Please suggest me or provide some example.

Here's how you can build up your "search muscles" so that you can SearchFirst (<-- click) next time.

Step 1: Note down key words in answers
Bear Bibeault wrote:a filter that checks for authentication is the way to go.


Step 2: Note down key words in your question.
arvind kushwaha wrote:I need to check prior to authentication. For Example suppose i had enter the gmail inbox url without providing authentication. So in that case login page is shown to me, not the gmail inbox url .
... I have no idea how to do that...Please suggest me or provide some example.


Step 3: Think of words that would make your search criteria more specific.

Step 4: Go to Google and type in the words. Hit "Search" and viola! A bunch of links that you can go through to find your answer!

In this case, you would Google for: authentication filter login java
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic