This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Get URL of parent page in an included JSP page

 
rishi athalye
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
rishi athalye
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic