File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes servlets and html pages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlets and html pages" Watch "servlets and html pages" New topic

servlets and html pages

Bala Krishniah
Ranch Hand

Joined: Dec 14, 2000
Posts: 81
My jsp has 2 menus. The first menu makes a call to the servlet and the second menu is a static html page.
menu1 manu2
servlet1) (static html)

When clicked on the first, the resulting page will be a jsp page along with the above two menu options.
But when the second menu is selected, the resulting page is a static html page along with the same menu options.
First time the user selects the first menu option, (The 2nd menu, the user can view the info without logging)I take them to the login screen before displaying the result.
My problem is,
(Case 1.)The user slects the menu two first. And now slects the first menu. In this case the user has not logged in, so I need to take him to logging screen.
(Case 2)User logs in. The resulting pages is displayed. Then selects the menu2. Now when he selets the menu 1, I have to take him to the resulting screen of menu 1 and not the loggin screen.
In other words, before and after logging, the same html pages is selected.
So how do I make a check from the html page, whethet the user has logged in or not every time when the user selects the menu 1.
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Plain HTML pages can't make any intelligent decision as to the user logged or not etc.
I understand your situation. What you can do is, instead of menu2 linking to static html page directly, change the menu2 to link to a 'CheckServlet' which checks for 'loginInfo' in user's session and if presents, the 'CheckServlet' would forward the request whereever you want to. (either html/servlet/jsp resources). Otherwise, let the 'CheckServle' redirect to 'Login' Page again.
maha anna
Bala Krishniah
Ranch Hand

Joined: Dec 14, 2000
Posts: 81
Thank you Maha.
I agree. Here's the link:
subject: servlets and html pages
It's not a secret anymore!