Solved

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

Posted on 2004-10-13
3
1,954 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will learn how to count occurrences of each item in an array.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

737 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