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.
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

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
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: 63349

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] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Checking for specific page
It's not a secret anymore!