【问题标题】:Use spring tags in html在html中使用spring标签
【发布时间】:2018-03-07 17:05:02
【问题描述】:
<!doctype html>
<head>
    <meta charset="utf-8">
    <title>Urban Wolf - Boutique Brand Management Firm</title>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="theme-color" content="#fff">
    <meta name="description" content="Urban Wolf, the Palm Beach based boutique brand management firm with specializations in brand development, branding, and business consulting. No one wants to be the sheep">
    <link rel="shortcut icon" href="Sheep/img/favicon-client2.png" type="image/png">
    <link rel="icon" href="Sheep/img/favicon-client2.png" type="image/png">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" media="all" href="Sheep/css/app.css">
</head>

<body>
    <p class="form__placehold">Full Name</p> <input class="form__input" name="name" type="text" pattern="^[а-яА-ЯёЁa-zA-Z0-9\s]+$" required>
    <p class="form__placehold">Email</p> <input class="form__input" type="email" name="_replyto" pattern="/^[\w]{1}[\w-\.]*@[\w-]+\.[a-z]{2,4}$/i" required> <button class="form__btn" type="submit">Send Now</button> </form>
    </div>
    </div>
    </div>
    <!--end map-block-->
    <footer class="footer">
    <div class="container">
    <a class="footer__logo" href="#"> <svg class="icon icon-logo"><use xlink:href="Sheep/img/sprite.svg#icon-logo"></use></svg> </a>
    <p class="footer__copyright"> <span>&copy;</span> 2017 URBAN WOLF MANAGEMENT LLC. ALL RIGHTS RESERVED </p>
    </div>
    </footer>
    </div>
</body>
</html>

如何将 Spring 标记连接到 HTML 文档,真的吗?或者如果我使用 Spring,我必须只使用 JSP 页面?

【问题讨论】:

    标签: java html spring spring-mvc jsp-tags


    【解决方案1】:

    如果要在html中使用Spring标签,则必须使用JSP。如果你想让页面看起来更像 HTML,你可以使用thymeleaf。您可以找到使用 thymeleaf here 的区别/优势。

    【讨论】:

      【解决方案2】:

      您将包含 spring 标记。要包含 spring 标记,JSP 文件应具有以下定义的信息。

      <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
      <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
      

      强烈建议使用 JSTL 标签。但是要开始使用整个 spring 标签,您可以在 GITHUB repo.,pet-clinic 中使用 spring 框架示例。干杯。

      【讨论】:

        【解决方案3】:

        您必须为此使用 JSP...您可以找到更多信息here, 如果您不想使用 JSP,可以尝试使用 Thymeleaf

        【讨论】:

          【解决方案4】:

          如果你想使用 Spring 标签/Spring 表单,你必须只使用 jsp 文档。如果需要,您可以在单个 jsp 页面中混合使用 Spring 表单标签和 HTML 表单标签。

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2016-01-02
            • 1970-01-01
            • 1970-01-01
            • 2014-12-19
            • 1970-01-01
            • 2012-09-24
            • 2012-03-27
            • 1970-01-01
            相关资源
            最近更新 更多