简体   繁体   中英

Thymeleaf with iframe

I am having an issue using a javascript switch statement with Thymeleaf. I have searched throughout but cannot find any examples so I am might just be off on design or understanding. I am trying to use iframes to keep a main banner at the top of this SPA. This is not a public web site but a rather simple application. (Java/Spring/Thymeleaf).

Anyhow given:

switch (event.target.id)
                {
                    case "dashtab":
                        $('.iframeContainer').height(1100);
                        $('#iframe').attr('src', 'Dashtab.html');
                        break;
                    case "detailtab":
                        $('.iframeContainer').height(800);
                        $('#iframe').attr('src', 'Details.html');
                        break;

I am trying to call the individual html pages. To do this normally (not in a switch stmt) I would simply call:

<iframe id="iframe" th:replace="Orders::html"></iframe>

Any thoughts as to the syntax for this? None of my attempts at using the attr/src is working. I could not find examples or documentation on the usual websites.

Don, you have to specify a working URL for the iframe source attribute (src). For example, the link like http://127.0.0.1:8080/Dashtab.html if your HTML pages are served and accessible through this path.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM