This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Checking for specific page" Watch "Checking for specific page" New topic
Author

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
Marshal

Joined: Jan 10, 2002
Posts: 60773
    
  65

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]
 
 
subject: Checking for specific page
 
Similar Threads
What is the term? A redirect at the server level...
Getting the URL from the request using Struts?
Refreshing a page before forwarding
Static includes in Portlet jsp
submitting page to itself