Home >Web Front-end >HTML Tutorial >The parent page gets the content of the child page_html/css_WEB-ITnose
Requirement description: Two JSP pages. The parent page needs the content of the child page, but the child page is hidden. Specifically, the child page is a series of templates, and the parent page needs to obtain these templates through ID. , unwilling to import through
1, through ajax Method
Implementation process: request to the subpage through ajax, and the subpage gets the parameter id and uses the interaction of java and js variables to return the required template information
Disadvantage: convert the js variable into Java variables are more troublesome. They need to be submitted using form forms, and the java script in jsp is run on the server side, which requires server-side resource overhead and increases the number of interactions
2, introduced through iframe
Implementation process: Use iframe to introduce subpages, and then obtain the required template through $(iframe.contents().find("#" id)[0]).val().
Disadvantages: Not sure if iframe can be delayed loaded. If you want to import the entire page like
We welcome readers and netizens to put forward their own opinions and methods for improvement.