File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes jsp:import Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp:import" Watch "jsp:import" New topic


Raymond Sabbatini

Joined: Dec 16, 2003
Posts: 6
There may be a thread dealing with this somewhere... so apologies if there is (i'm a greehorn on this site)
I'm trying to find out the following: if I use jsp:import to incorporate a web page (using an absolute URL) within my web page, then if a user clicks on a link on the imported web page, is it possible to get hold of the the SRC value (as a parameter) so that instead of returning just the URL referenced web page, I will be able to display, in the user's browser, the page they want, but with my web page 'including' it. In other words, I would like to have a series of my own web pages, which all include external content, but without allowing the user to simply load the external source and ignore my content.
I hope this is clear(!).
I may be missing some easier way to do this, so that's another reason for asking. I mean it may be that I need to use ASP or PHP...
I could, of course, use frames, but that is something I am, at this stage trying to avoid.
Also, I am lead to understand that even ignoring the problem of user clicked links (above), that jsp:import only works for text in external content, not images. I haven't even begun to think whether any of this would work for complex external sources, such as forms, login on, searches etc.
Tim Baker
Ranch Hand

Joined: Oct 04, 2003
Posts: 541
Using the include it just grabs the referenced file and includes it in your JSP which then gets passed on to the user, you can't intercept their links that way AFAIK. You would have to use something else to grab the page, then parse the source changing all the hrefs to point to your site with the external sites url as a parameter or something. If their site uses relative image locations then that would be a problem for you because the client would then request the images off your server. if the images used absolute addressing it would be OK.
A simpler way would be to use an iframe, where the external links would change the site shown within the iframe and not affect your surrounding site.

Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
I agree. Here's the link:
subject: jsp:import
It's not a secret anymore!