Solved

Scope of URL Query String Parameters to JSPs That Are Included By Other Pages

Posted on 2004-10-13
3
1,953 Views
Last Modified: 2013-11-18
Hi,

   I have a small JSP TV-Listings code snippet ('mini_listings4.jsp') that is always designed to be used by a parent page that includes it. The JSP include pulls out tv listings for a particular day (don't worry I've got this bit working perfectly) and Xpaths them for display. It is important to realise that the parent page that includes this TV listings JSP, doesn't necessarily have to be a JSP itself; it could be an '.htm' file using a <!--#include virtual="mini_listings4.jsp" ---> to pull in the TV listings JSP.
Here's my problem. I'm using code in the TV-Listings JSP include to sniff out a query string that may or may not be appended after the parent's page URL to determine whether it is today's or tomorrow's TV schedule that is displayed. If it's today's TV (default) to be displayed, then a link is output for dispaying tomorrow's TV ('<a href="?showtvfor=tomorrow">' and vice versa if the parameter stipulates that it's tomorrow's TV to display. The problem is that the JSP included cannot see the query string because it considers it be  solely within the scope of the parent page that pulls it in. So these lines in the JSP include:

out.println("<!-- " + request.getQueryString(); + "-->");
          out.println("<!-- " + request.getParameter("showtvfor") + "-->");

result in "<!-- -->" and "<!-- null-->" when the JSP is invoked as an include (even if the URL of the parent page that pulls it in is "www.mydomain.com/T/test/full4ltvlistsings.htm?showtvfor=tomorrow"

But if you pointed your browser to the JSP directly, it works fine (see below):
<!-- showtvfor=tomorrow-->
<!-- tomorrow-->

 Anybody got a fix or should I create a JSP session variable instead?
0
Comment
Question by:jboyfinn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 125 total points
ID: 12298460
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
The viewer will learn how to count occurrences of each item in an array.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

761 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question