Solved

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

Posted on 2004-10-13
3
1,941 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
Comment Utility
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When you work with shopping cart / ecommerce relates web sites, you need to pass the certain form post details to the payment gateway process page with required details for the products items you give to order. Also you may need to track the ordered…
It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now