This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

include a html page in JSP file

 
David Wei
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can I use "include" to include a html page, which is in a defferent server, into my JSP file? Is there anything in JSP like "href" to link html pages.
Thanks in advance.
David
 
Ruilin Yang
Ranch Hand
Posts: 150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. You can test this yourself.
 
David Wei
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I test? What are the codes like? Thanks,
David
 
Ruilin Yang
Ranch Hand
Posts: 150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<jsp:include page="pathAndFileName.html" flush="true" />
 
domestique jackson
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mention that the include file is on a different server. The only thing to remember is that the include file has to be specified as a "relative path".
Syntax reference from Sun:
<jsp:include page="{relativeURL | <%= expression %>}"
flush="true| false" />

The relative URL looks like a pathname--it cannot contain a protocol name, port number, or domain name. The URL can be absolute or relative to the current JSP page. If it is absolute (beginning with a /), the pathname is resolved by your web or application server.
i.e. you could NOT do the following:
<jsp:include page="http://www.cnn.com/todayNews.html">
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm pretty sure that there are a couple of custom tags that do this for you. First is the <c:import> tag from JSTL, and there's the IO taglib. Both can be found at the Jakarta Taglibs project.
HTH
Simon
[ September 13, 2002: Message edited by: Simon Brown ]
 
domestique jackson
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simon,
Thanks. You know where I could find the implentation of <c:import> tag. Curious to see how it was implemented.
thanks.
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by domestique jackson:
[QB]You know where I could find the implentation of <c:import> tag.QB]

Yes, you can download the source code for the reference implementation from the Jakarta website.
Cheers
Simon
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic