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
Solved

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

Posted on 2004-10-13
3
1,951 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
3 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 125 total points
ID: 12298460
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to hide hide popup page refresh second time? 10 141
Re-position sub-options beneath the TAB 7 98
Why my table column Id is not passed to java object? 4 44
jsp login check 12 42
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

808 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