File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Any Suggestion? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Any Suggestion?" Watch "Any Suggestion?" New topic

Any Suggestion?

Chris Goh

Joined: Aug 23, 2001
Posts: 23
Hi all!
I'm relatively new to JSP and I'm having some doubts doing a login page using jsp.
Say, after a user enters his username and password, the username is used to retrive a password from the database. This password is then compared with the one he enters and if it matches will let the user access *some secret pages*. How can i prevent ppl from accessing the *secret pages* by directly typing the URL in their browsers.

The Greenest Of Horns
Rehan Malik
Ranch Hand

Joined: Jul 09, 2001
Posts: 76
Add the following code to top of "secret pages":
[This message has been edited by Rehan Malik (edited August 24, 2001).]

Rehan Malik
Subbu Aswathanarayan
Ranch Hand

Joined: Jun 22, 2001
Posts: 73
after the user successfully logs on, put an object (probably containing his user id) in to the all ur "secret pages" try to retrieve this object from the session.if u cant, redirect the user to an error page.
hope this helps.

Chris Goh

Joined: Aug 23, 2001
Posts: 23
I agree. Here's the link:
subject: Any Suggestion?
It's not a secret anymore!