How to include dynamic JSP from another server on a JSP page
-
01-10-2019 - |
Question
I am writing a some code that to dynamically include an HTML snippet in a page. Basically, I have course information on one server, which I want other servers to be able to include with a single line of code.
If it was on the same server, I would use this:
<jsp:include page="coursedescription.jsp?subj=ENGL100" />
But the JSP page is on a different server. This is what I have tried, and it does not work:
<jsp:include page="http://myotherserver.com/courselist.jsp?subj=ENGL" />
How can I include that snippet from the other JSP page, by specifying the URL?
Solution
you can use c:import
tag for doing this. The other way is to fetch the content in the server side using commons HTTP and include the result inline.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow