This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a servlet, which takes me through few pages, among which the 1st page is security page which is also a servlet,only if valid then takes to the nextpage, say if i bookmark a particular page in the 1st servlet, the next time i open the bookmarked page, it should only take me to the security page ie security servlet and then get back to the bookmarked page. So in order to have this functionality what is the good approach to implement this. I think Hidden Form field or cookie might work. Could anyone please help me out with this! Thanks,
Hi You could use a hidden form field, but it can be seen through a "view source" in the browser. You can also use a cookie but that would then allow someone else sitting down at the same computer (that a previous user already accessed the site with) access to your protected pages. My suggestion, use a HttpSession and store a bean/object into it. This way you can store user preferences into the session, one of them being an 'authenticated' boolean. If the boolean is set to true, allow them to see the page you want, if it's false (not loggged in, or bad login) redirect them to the main page. Hope this helps.
[This message has been edited by John Bateman (edited April 25, 2000).]
SOURCE CODE should be SURROUNDED by "code" tags.
Joined: Nov 22, 2008