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

Checking for specific page

Joseph Smithern
Ranch Hand

Joined: Feb 11, 2006
Posts: 89
I am trying to create a condition to check if I am on a specific web page .

Please advise how I can do that because this will be located in the top of a template page in my JSP pages. If the user goes to the specific page called page.jsp then I want the above condtion to kick in.
[ April 17, 2006: Message edited by: Joseph Smithern ]
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63852

Checking for the specific page URL would be a poor way to do something like this. It's too subject to change based upon server and changes to the projects.

Rather, I'd set a page-scoped variable that would trigger the behavior.

Using JSTL syntax, on the page:

and in the "template":

If you're not using the JSTL, you should be. If you're still not using the JSTL, scriplet equivalents of the code are easy to figure out.
[ April 17, 2006: Message edited by: Bear Bibeault ]

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Checking for specific page
It's not a secret anymore!