| Author |
include a html page in JSP file
|
David Wei
Greenhorn
Joined: Jan 04, 2002
Posts: 17
|
|
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
Joined: Jan 06, 2002
Posts: 150
|
|
|
Yes. You can test this yourself.
|
 |
David Wei
Greenhorn
Joined: Jan 04, 2002
Posts: 17
|
|
How do I test? What are the codes like? Thanks, David
|
 |
Ruilin Yang
Ranch Hand
Joined: Jan 06, 2002
Posts: 150
|
|
|
<jsp:include page="pathAndFileName.html" flush="true" />
|
 |
domestique jackson
Greenhorn
Joined: Aug 29, 2002
Posts: 10
|
|
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
Joined: May 10, 2000
Posts: 1860
|
|
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
Joined: Aug 29, 2002
Posts: 10
|
|
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
Joined: May 10, 2000
Posts: 1860
|
|
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
|
 |
 |
|
|
subject: include a html page in JSP file
|
|
|