- Posted by: prakash dewangan
- Posted on: December 10 2002 06:19 EST
I need to include the to pages in my jsp, both are comming from differet server.
I am trying like
< % @include file="http://www.abc.com/example1.jsp" % >
< % @include file="http://www.xyz.com/example2.jsp" % >
nested TokenStreamException: antlr.TokenStreamException: Could not include http://www.abc.com/example1.jsp
and when I am trying
ServletContext sc = pageContext.getServletContext();
RequestDispatcher rd = sc.getRequestDispatcher("http://www.abc.com/example1.jsp");
it throws NullPioterException as "sc" is null
Do you know how to include the page from the different server( different servletContext).
if yes.. pls help me out..
Thanx in advance
- Include jsp from different server by Web Master on December 10 2002 07:48 EST
- Include jsp from different server by prakash dewangan on December 10 2002 09:31 EST
The RequestDispatcher and <%@ include%> only work for resources w/in the same context...ie..same app.
You could write your own custom tag that opens a UrlConnection to the specified url, grabs the contents and inserts it into your page.
<%@taglib uri="/WEB-INF/custom.tld" prefix="include" %>
Thats right I can create the tag lib for this.... If you already created tag lib for this then please give me the sample code.
I don't have any problem in using ServletContext or RequestDespatcher inside the JSP.....
I need to include to different pages comming from different server.
if you have the solution in any form (jsp / servlet / taglib ) please send the sample code.
I have not written one. One thing to watch out for if you do write one:
If the page your including has any relative urls in it (images, links, scripts, etc...), they wont load/work. Any of these must be fully qualified for it to work.
I wonder if there is any limitation to the number of connections that are opened by one jvm. If the loaded pages were slow I quess an increase in the number of connections may become a problem. Also trying to download pages from an appserver and including it into our jsp may cause also bad performance issues.
Am I right at these points?
There are. Sockets are limited resources in JVM. The number of connections a JVM can handle is dependant on the underlying OS.