I have a bizarre requirement. I need to download a jsp templates from another web app and get the dynamic html response as a string using my java app. I know how we can achieve this by ServletContext.getRequestDispatcher(), but getRequestDispatcher() cannot go to outside of the application and my application is not a web app. In short, my app has the data and the jsp template comes from another app. I'm thinking I can get the inputstream of this jsp template and write the dynamic data sonwhow? Any ideas?
Asked
Active
Viewed 96 times
0
-
@cricket_007 It doesn't explain how I can send an object to the request as attributes. How can I get the dynamic html response without sending an object? – nullPointer2 Aug 01 '16 at 20:03
-
You mean a `POST` request? – OneCricketeer Aug 01 '16 at 20:04
-
1Overall, you can't download a pre-rendered raw template from a web server unless it is being hosted as a plain text file. – OneCricketeer Aug 01 '16 at 20:05
-
@cricket_007 Using HttpURLConnection I can get the inputstream of jsp. Is there a way to put the dynamic content into that jsp? – nullPointer2 Aug 01 '16 at 20:32