You can follow below steps to render externalUrl using Servlets.
Create a custom Servlet in AEM that will handle the request to fetch and render the external HTML content.
In the Servlet, use Java libraries or frameworks (e.g., Apache HttpClient) to fetch the HTML content from the external URL.
Once you've fetched the HTML content, you can process it and render it as needed. You can use methods like response.getWriter().write(htmlContent) to write the fetched HTML to the response.
In JavaScript write a ajax call to fetch the response.
Append the external html using JavaScript code on the basis of ID,<div id = "external-form">
You can make an httpclient call with getmethod by setting the URL like "http://host:port/pagepath.html". Make sure you add the content type to the header before executing. For any manipulation in Html you can use Jsoup.
You can follow below steps to render externalUrl using Servlets.
Create a custom Servlet in AEM that will handle the request to fetch and render the external HTML content.
In the Servlet, use Java libraries or frameworks (e.g., Apache HttpClient) to fetch the HTML content from the external URL.
Once you've fetched the HTML content, you can process it and render it as needed. You can use methods like response.getWriter().write(htmlContent) to write the fetched HTML to the response.
In JavaScript write a ajax call to fetch the response.
Append the external html using JavaScript code on the basis of ID,<div id = "external-form">