首页 > 解决方案 > Spring安全表单操作登录不起作用

问题描述

我正在尝试使用表单登录对 Spring Security 进行身份验证。

我正在使用自定义身份验证。当我的系统有 Java 1.8 时,它运行良好。最近我已经将 Java 1.8 升级到 1.10,然后不再提交表单。我得到以下错误。

 This www.act.com page can’t be found
 No webpage was found for the web address: www.act.com/appname/login
 HTTP ERROR 404

下面是我的登录表格。

    <form class="smart-form client-form"  name ="login" id="login-form" 
                        accept-charset="UTF-8"  role="form" method="post">
                        <header> Log In </header>

                        <fieldset>
                            <section> <label class="label">User Name</label> <label
                                class="input"> <i class="icon-append fa fa-user"></i> <input
                                type="text" name="username" id="uname"/> <b
                                class="tooltip tooltip-top-right"><i
                                    class="fa fa-user txt-color-teal"></i> Please enter username</b></label> </section>

                            <section> <label class="label">Password</label> <label
                                class="input"> <i class="icon-append fa fa-lock"></i> <input
                                type="password" name="password" id="pw" /> <b
                                class="tooltip tooltip-top-right"><i
                                    class="fa fa-lock txt-color-teal"></i> Enter your password</b>
                            </label>

                            </section>
                             <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>

                        </fieldset>
                        <footer>
                        <button type="submit" class="btn btn-primary btn-lg">Sign in</button>

我在 jquery 中提交表单时附加操作。

  $('#login-form').attr('action',"login");

任何人都有建议。我们将不胜感激您的帮助。

标签: javajspspring-securitycustom-authentication

解决方案


推荐阅读