Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.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 在同一页面上多个超链接_Html_Spring Mvc_Web_Spring Security_Frontend - Fatal编程技术网

Html 在同一页面上多个超链接

Html 在同一页面上多个超链接,html,spring-mvc,web,spring-security,frontend,Html,Spring Mvc,Web,Spring Security,Frontend,我一直在尝试在同一页上设置两个超链接。出于某些原因,无论单击超链接做出何种选择,它都会打开与第一个选项关联的html页面。我错过什么了吗 Spring安全示例 欢迎 单击以进行登录 单击以注册为新用户 这是login.html <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="https://www.thymeleaf.org" xmlns:sec="https://

我一直在尝试在同一页上设置两个超链接。出于某些原因,无论单击超链接做出何种选择,它都会打开与第一个选项关联的html页面。我错过什么了吗


Spring安全示例
欢迎
单击以进行登录

单击以注册为新用户

这是login.html

    <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="https://www.thymeleaf.org"
      xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
    <head>
        <title>Spring Security Example </title>
    </head>
    <body>
        <div th:if="${param.error}">
            Invalid username and password.
        </div>
        <div th:if="${param.logout}">
            You have been logged out.
        </div>
        <form th:action="@{/login}" method="post">
            <div><label> User Name : <input type="text" align="center" name="username"/> </label></div>
            <div><label> Password: <input type="password" align="center" name="password"/> </label></div>
            <div><input type="submit" value="Sign In"/></div>
        </form>
    </body>
    </html>
这可能会有帮助

在href中拆分字符串

@{'/'+${login}

像这样:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="https://www.thymeleaf.org" xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity3">

<head>
  <title>Spring Security Example</title>
</head>

<body>
  <h1>Welcome</h1>
  <p>Click <a th:href="@{'/' + ${login}}"> here </a>for login. </p>
  <p>Click <a th:href="@{'/' + ${registration}}"> here </a>to register as a new user.</p>
</body>

</html>

Spring安全示例
欢迎
单击以进行登录

单击以注册为新用户

这可能会有所帮助

在href中拆分字符串

@{'/'+${login}

像这样:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="https://www.thymeleaf.org" xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity3">

<head>
  <title>Spring Security Example</title>
</head>

<body>
  <h1>Welcome</h1>
  <p>Click <a th:href="@{'/' + ${login}}"> here </a>for login. </p>
  <p>Click <a th:href="@{'/' + ${registration}}"> here </a>to register as a new user.</p>
</body>

</html>

Spring安全示例
欢迎
单击以进行登录

单击以注册为新用户


请从查看源代码中显示呈现的html-此处斜杠看起来可疑
@{/login}
您应该添加一些特定于正在使用的前端框架的标记。问题在于我为应用程序添加的安全机制。注册页面应允许在没有任何安全检查或登录要求的情况下打开。稍后在注册过程中,我们可以验证用户是否是真正的用户,但初始步骤不需要任何东西。请从查看源代码显示呈现的html-此处斜杠看起来可疑
@{/login}
您应该添加一些专门关于正在使用的前端框架的标记。问题在于我为应用程序添加的安全机制。注册页面应允许在没有任何安全检查或登录要求的情况下打开。稍后在注册过程中,我们可以验证用户是否是真正的用户,但初始步骤不需要任何东西。或者可能是
“/{login}”
或者
“/{login}”
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="https://www.thymeleaf.org" xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity3">

<head>
  <title>Spring Security Example</title>
</head>

<body>
  <h1>Welcome</h1>
  <p>Click <a th:href="@{'/' + ${login}}"> here </a>for login. </p>
  <p>Click <a th:href="@{'/' + ${registration}}"> here </a>to register as a new user.</p>
</body>

</html>