This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
We have a shtml page. Within this page, we have included a JSP page. How do i get the URL of the parent/shtml page from within this JSP page ? I tried getRequestURI etc, but i just get the URL of the JSP page. Referrer will also not work as that is some other page. Thanks.
Because the server-side include is being handled completely outside of the JSP/Servlet arena, there isn't likely to be a way to obtain this information unless your web server somehow makes it available as a system parameter or something. What web server is handling the ssi? If the web server does not make this info available, then a somewhat hacky way to do this (if it is absolutely essentiall information -- I'd examine my design to see why I needed this info before resorting to hacks) is to pass the info on the request to the JSP page (assuming your ssi engine allows that). Not much help, bear
Thanks. We are using JRun. I tried even passing it as a query string to the original page, but as you said, it's outside the scope of the JSP request and thus the request object does not catch the parameters. Also, I can't pass any query string with the include directive like that -- include virtual="xyz.jsp?fname=abc" Is there any way i can pass any parameter to the JSP page from an html/shtml page. I am now going to look into setting custom headers and try to get it through getHeaderNames.
Before resorting to fragile hackery, examine why it is that you need to know where you came from within the JSP page. Backing off from the problem might reveal a better design with a cleaner solution. hth, bear
subject: Get URL of parent page in an included JSP page