Zhijian Zhijian - 9 months ago 51
Java Question

How to render a remote JSP file with Java?

I want my server to render a remote JSP file and replace its variables with server given. The content of the JSP file is like below.


I use
<c:import var="alertContent" url="http://www.google.com/example.jsp"/>
to import this remote JSP file, but I found the content is treated as

So my questions are:

  1. How to treat this file as a JSP file instead of String and replace the template with valid values?

  2. If the JSP file contains customer taglib, how to render it successfully?

Answer Source

JSP files are compiled on the server so the you cannot use the URL as JSP file. You will only get the rendered HTML output.

So the output you are getting is working as it supposed to work.