我使用Roo和gvnix插件为登录表单生成了以下JSP spring安全代码。身份验证工作正常,但我无法在导航器(Firefox,IE)中自动登录。他们只是建议保存一个我还没有设置的"X“用户名,并且在返回表单时没有任何建议。我只是找不到为什么我输入的用户名没有保存...有什么想法吗?谢谢
<div>
<label for="j_username">
<spring:message code="security_login_form_name"/>
</label>
<input id="username" name="j_username" style="width:150px" type="text"/>
<spring:message code="security_login_form_name_message" htmlEscape="false" var="name_msg"/>
<script type="text/javascript">
<c:set var="sec_name_msg">
<spring:escapeBody javaScriptEscape="true">${name_msg}</spring:escapeBody>
</c:set>
Spring.addDecoration(new Spring.ElementDecoration({elementId : "j_username", widgetType : "dijit.form.ValidationTextBox", widgetAttrs : {promptMessage: "${sec_name_msg}", required : true}}));
</script>
</div>
<div>
<label for="j_password">
<spring:message code="security_login_form_password"/>
</label>
<input id="j_password" name="j_password" style="width:150px" type="password"/>
<spring:message code="security_login_form_password_message" htmlEscape="false" var="pwd_msg"/>
<script type="text/javascript">
<c:set var="sec_pwd_msg">
<spring:escapeBody javaScriptEscape="true">${pwd_msg}</spring:escapeBody>
</c:set>
Spring.addDecoration(new Spring.ElementDecoration({elementId : "j_password", widgetType : "dijit.form.ValidationTextBox", widgetAttrs : {promptMessage: "${sec_pwd_msg}", required : true}}));
</script>
</div>
<div class="submit">
<script type="text/javascript">Spring.addDecoration(new Spring.ValidateAllDecoration({elementId:'proceed', event:'onclick'}));</script>
<spring:message code="button_submit" htmlEscape="false" var="submit_label"/>
<input id="proceed" type="submit" value="${fn:escapeXml(submit_label)}"/>
</div>发布于 2018-02-13 16:51:25
从安全的角度来看,用户名的自动补全被认为是不好的做法。
用户可以自由地指示他们的浏览器保存他们的凭据信息,并在自动完成操作中使用它,但应用程序不应强制执行此行为。
您的需求似乎更多地与浏览器相关,而不是Spring框架。
一般来说,可能值的自动补全意味着有人键入一个值,自动补全会从存储中获取满足条件(例如,以开头)的所有值。我猜你不希望有人能够使用这个自动补全功能从你的存储中取出你所有的用户名。
https://stackoverflow.com/questions/48762571
复制相似问题