Two JSP page parent page two ways to get the content of a _jsp programming

Source: Internet
Author: User

Requirements 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, the parent page to get through the ID of these templates, do not want to import through the <include> mode, because if the template too much, the entire parent page is too large , loading slowly, the following two scenarios, I do not know if there is no solution to this problem.

1, through the Ajax Way

Implementation procedure: Through the AJAX request to the child page, the child page obtains the parameter ID to use the Java and the JS variable interaction, returns the required template information

Disadvantages: To convert JS variables to Java variables more troublesome, need to use form table forms submit, and JSP Java script is running on the server side, need server-side resource overhead, and increase the number of interactions

2, through the introduction of IFRAME

Implementation process: Use the IFRAME to introduce a subpage, and then get the template you need by $ (iframe.contents (). Find ("#" +id) [0]). Val ().

Disadvantage: Not sure whether the IFRAME can be delayed loading, if you want to <include> the same as the entire page to import, this method is not OK.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.