Thymeleaf输入html代码直到结束才翻译

时间:2018-01-25 09:54:55

标签: java html spring-boot thymeleaf

我无法理解为什么Thymeleaf使用的HTML代码没有翻译到最后:

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <!--link href="../static/css/bootstrap.css" th:href="@{/css/bootstrap.css}" rel="stylesheet"/>
    <link href="../static/css/bootstrap-DEV.css" th:href="@{/css/bootstrap-DEV.css}" rel="stylesheet"/>
    <link href="../static/css/login-view.css" th:href="@{/css/login-view.css}" rel="stylesheet"/>
    <link href="../static/css/bootstrapAuth.css" th:href="@{/css/bootstrapAuth.css}" rel="stylesheet"/!-->
</head>
<body><div class="container">
    <div class="row" style="margin-top : 10px">
        <div class="col-md-6 col-md-offset-3 col-sm-12 col-xs-12">

            <div class="navbar navbar-inverse navbar-fixed-top">
                <div class="container-fluid">
                    <div class="navbar-header">
                <span class="navbar-brand">
                    <span>    <img src="../static/images/log_application.png" style="width:75px"/>      MOA/Onisep</span>
                    </span>
                    </div>
                </div>
            </div>

            <form action="#" th:action="@{/ResetPassword}" th:object="${forgotUserViewModel}" method="post">
                    <label for="mail">mail :</label>
                    <input type="hidden"
                           th:field="*{mail}"
                           id="mail"
                           name="mail"
                           class="form-control">
                    <label for="keyUser">keyUser :</label>
                    <input type="hidden"
                           th:field="*{keyUser}"
                           id="keyUser"
                           name="keyUser"
                           class="form-control">
                 <label for="password">Password :</label>
                    <input type="password"
                           th:field="*{password}"
                           id="password"
                           name="password"
                           class="form-control"
                           placeholder="password">
                    <label for="confirmPassword">Confirmer Password :</label>
                    <input type="password"
                           th:field="*{confirmPassword}"
                           id="confirmPassword"
                           name="confirmPassword"
                           class="form-control"
                           placeholder="confirmPassword">
                <button style="margin-top:10px" class="btn btn-default" type="submit">Submit</button>
            </form>
        </div>
    </div>
</div>
</body>
</html>

这里是服务器分发的源代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta content="charset=UTF-8" http-equiv="Content-Type" />
    <meta content="width=device-width, initial-scale=1.0" name="viewport" />
    <meta content="IE=edge" http-equiv="X-UA-Compatible" />
    <!--link href="../static/css/bootstrap.css" th:href="@{/css/bootstrap.css}" rel="stylesheet"/>
    <link href="../static/css/bootstrap-DEV.css" th:href="@{/css/bootstrap-DEV.css}" rel="stylesheet"/>
    <link href="../static/css/login-view.css" th:href="@{/css/login-view.css}" rel="stylesheet"/>
    <link href="../static/css/bootstrapAuth.css" th:href="@{/css/bootstrapAuth.css}" rel="stylesheet"/!-->

</head><body><div class="container">
    <div class="row" style="margin-top : 10px">
        <div class="col-md-6 col-md-offset-3 col-sm-12 col-xs-12">

            <div class="navbar navbar-inverse navbar-fixed-top">
                <div class="container-fluid">
                    <div class="navbar-header">
                <span class="navbar-brand">
                    <span>    <img src="../static/images/log_application.png" style="width:75px" />      MOA/Onisep</span>
                    </span>
                    </div>
                </div>
            </div>

            <form action="/ResetPassword" method="post">

                 <label for="password">Password :</label>
                    <input class="form-control" id="password" name="password" pl

控制器:

@RequestMapping(value="ResetPassword/{keyUser}",method = RequestMethod.GET)
public String resPassword(@PathVariable("keyUser") String keyUser, Model model, HttpServletResponse response) throws IOException, java.text.ParseException {


    String mail=cacheHash.getObjectIdForgetPasswordValueMail().get(keyUser);
    if(mail!=null){

        ForgotUserViewModel forgotUserViewModel=new ForgotUserViewModel();
        forgotUserViewModel.setKeyUser(keyUser);
        forgotUserViewModel.setMail(mail);
        model.addAttribute("forgotUserViewModel",forgotUserViewModel);
        return "resPassword";

    }else {
        response.setStatus(401);
        return null;
    }
}

Bean:

public class ForgotUserViewModel {

    private String keyUser;

    private String mail;

    private String password;

    private String confirmPassword;

    public String getMail() {
        return mail;
    }

    public String getKeyUser() {
        return keyUser;
    }

    public void setKeyUser(String keyUser) {
        this.keyUser = keyUser;
    }

    public void setMail(String mail) {
        this.mail = mail;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getConfirmPassword() {
        return confirmPassword;
    }

    public void setConfirmPassword(String confirmPassword) {
        this.confirmPassword = confirmPassword;
    }
}

你知道什么会停止翻译吗?

0 个答案:

没有答案