Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/313.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
html布局中的h2数据库控制台:片段(Spring Boot+;Java)_Java_Html_Spring Boot_Fragment_H2 - Fatal编程技术网

html布局中的h2数据库控制台:片段(Spring Boot+;Java)

html布局中的h2数据库控制台:片段(Spring Boot+;Java),java,html,spring-boot,fragment,h2,Java,Html,Spring Boot,Fragment,H2,我正在开发一个Spring启动应用程序。我使用main.html作为嵌入的所有其他.html的框架。为此,我使用了layout:fragment 我的导航栏中还有一个“数据库”菜单,指向H2数据库控制台 是否可以将此控制台作为片段嵌入到main.html中 main.html的正文: <body> <div class="container"> <nav class="navbar navbar-

我正在开发一个Spring启动应用程序。我使用
main.html
作为嵌入的所有其他.html的框架。为此,我使用了
layout:fragment

我的导航栏中还有一个“数据库”菜单,指向H2数据库控制台

是否可以将此控制台作为片段嵌入到
main.html

main.html
的正文:

<body>
        <div class="container">
            <nav class="navbar navbar-default">
                <ul class="nav navbar-nav">
                    <li><a href="/">HOME</a></li>
                    <li><a href="/blogs">BLOGS</a></li>
                    <li><a href="/bloggers">BLOGGERS</a></li>
                    <li sec:authorize="hasRole('ROLE_ADMIN')"><a href="/admin">ADMIN</a></li>
                    <li sec:authorize="hasRole('ROLE_ADMIN')"><a href="/database">DATABASE</a></li>
                    <li><a href="/signup"><button id="signup-small-button" class="btn btn-success">SIGN UP</button></a></li>
                </ul>
                <div class="navbar-right">
                    <form sec:authorize="!isAuthenticated()" th:action="@{/loginfailed}" method="post">
                        <input th:value="${username}" type="text" name="username" placeholder="username" required class="login-input"/>
                        <input th:value="${password}" type="password" name="password" placeholder="password" required class="login-input"/>
                        <button type="submit" id="login-button" class="btn btn-success btn-xs">Log in</button>
                    </form>
                    <div sec:authorize="isAuthenticated()">
                        <span th:text="${#authentication.name + ' | '}" class="black"></span>
                        <form th:action="@{/logout}" method="post" id="logout-button-form">
                            <button type="submit" id="logout-button" class="btn btn-primary btn-xs">Log out</button>
                        </form>
                    </div>
                </div>
            </nav>
            <div layout:fragment="content"></div>
            <footer>
                <hr/>
                <p id="footer">Made by hazazs (©Copyrighted by hazazs™)</p>
            </footer>
        </div>
</body>

登录 注销

由hazazs制作(©版权归hazazs所有™)


解决方案是一个
数据库.html
文件:

<html layout:decorate="~{layout/main}">
    <head>
        <title>DATABASE</title>
    </head>
    <body>
        <div layout:fragment="content" class="center">
            <iframe src="http://IP:PORT/h2" id="h2-console"></iframe>
        </div>
    </body>
</html>
application.yaml:

spring:
    h2:
        console:
            enabled: true
            path: /h2

请参考这些链接,我不想嵌入数据库数据,而是整个控制台
spring:
    h2:
        console:
            enabled: true
            path: /h2