【问题标题】:J_scurity_check fails in Firefox 4J_security_check 在 Firefox 4 中失败
【发布时间】:2011-08-21 20:07:15
【问题描述】:

应用程序在 Firefox3.6 和所有版本的 IE 中都能正常运行。我下载了 Firefox 4 并尝试登录。当我输入用户名和密码并单击提交按钮时,它只是清除标签,当我点击刷新按钮时,它会提交表单。如果我输入错误的用户名和密码,它会重定向到错误页面。

<form method="POST" action="j_security_check">
  Username: <input type="text" name="j_username"> <br/> 
  Password: <input type="password" name="j_password">
  <input type="submit" value="Login">
</form>

日志中没有错误消息。

【问题讨论】:

    标签: firefox4 j-security-check


    【解决方案1】:

    我仍然不知道您的问题,因为您没有提供有关您的环境和应用程序的太多详细信息。例如,您是否在登录页面中使用任何 javascript 或 ajax?标签之间是否有一些格式错误的标签?

    就我而言,我使用的是 java-ee-5、JSF 2.0 框架(我的登录页面在 Firefox 3.6、Opera 11 和 IE8 中有效,但在 Google Chrome 中无效)

    这是我的工作登录页面(在 Firefox 3.6.17 和 4.0.1 上测试)。

     <?xml version='1.0' encoding='UTF-8' ?>
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml"
              xmlns:p="http://primefaces.prime.com.tr/ui"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:ui="http://java.sun.com/jsf/facelets"
              xmlns:o="http://openfaces.org/">
            <h:head>
                <div align="center">
                    <h:outputText value="Logon" 
                                  style="text-align: center;font-weight: bolder"/>
                    <br />
                </div>
                <h:outputStylesheet name="css/style.css"/> 
                <link rel="icon" href="#{resource['images/diagnostic.ico']}" type="image/x-icon"/>
                <link rel="shortcut icon" href="#{resource['images/diagnostic.ico']}" type="image/x-icon"/>
            </h:head>
            <h:body style="font-weight: lighter;background: url(#{resource['images/master-bg.jpg']});background-repeat: repeat;">
        <h:form id="logonform" onsubmit="document.logonform.action = 'j_security_check';">
                            <p:panel header="#{bundle.Login}" style="font-weight: lighter">
                                <h:panelGrid columns="2">
                                    <h:outputLabel for="j_username" value="#{bundle.Username}" style="font-weight: bold;"/>
                                    <input id="usernameid" type="text" name="j_username" />
    
                                    <h:outputLabel for="j_password" value="#{bundle.Password}" style="font-weight: bold;"/>
    
                                    <input type="password" name="j_password" />
                                    <h:outputText value="" />
                                    <h:panelGrid columns="2">
                                        <p:commandButton value="Connexion" type="submit" ajax="false"/>
                                        <p:button outcome="Logon" value="Cancel" />
                                    </h:panelGrid>
                                </h:panelGrid>
                            </p:panel>
                        </h:form>
        </h:body>
        </html>
    

    我使用与您相同的纯 html 表单,它在 Firefox 4.0.1 中也适用于我,甚至比 3.6.17 更好。

    【讨论】:

      【解决方案2】:

      我也在寻找这个问题的答案。我正在开发一个在 Glassfish 中运行的 JavaEE6/JSF2 Web 应用程序(最初是 3.0.1,现在是 3.1)。

      基于 FORM 的登录在 Firefox3.x 版本上运行良好,在 Safari5.0.5 上仍然运行良好,但在 Firefox4.0.1 和 Google Chrome 12.0.742.91 上“静默失败”。 (我在 Mac OS X 上,没有检查过 IE。)

      提供诊断非常困难,因为没有。

      问:我可以为 Firefox 和/或 Google Chrome 打开其他日志或可能的诊断来源吗?

      这是我的表格:

       <form  id="loginForm" method="POST" action="j_security_check">
      
      <h:panelGrid columns="3" styleClass="login" columnClasses="login-label, login-field">
      <h:outputLabel for="j_username">Username:</h:outputLabel>
      <h:inputText id="j_username" required="true" />
      <h:message for="j_username" />
      
      <h:outputLabel for="j_password">Password:</h:outputLabel>
      <h:inputSecret id="j_password" required="true" />
      <h:message for="j_password" />
      
      <h:outputLabel for="login_button"></h:outputLabel>
      <h:commandButton id="login_button" value="Login" />
      </h:panelGrid>
      

      这类似于其他地方显示的声称与 Firefox 4 兼容的示例,例如来自此处(为尊重此处未复制的版权条件,请检查外部链接然后返回): enter link description here

      该登录表单声称与 Mozilla Firefox 4、Internet Explorer 8、Chrome 11、Safari 5、Opera 11 兼容。但我看不出它与我自己的有很大不同。

      【讨论】:

      • 好吧,我刚刚测试了javaevangelist.blogspot.com/2011/06/… 讨论的那个,你可以从commondatastorage.googleapis.com/bluelotussoftware/code/… 下载它,它在 Firefox4 和 Google Chrome 12 中都对我有用,但我看不出有什么区别他和我之间是(除了在表格中使用名称而不是id,我在我的尝试但没有工作)。
      • 好的,我找到了我的问题;我使用的是具有外部 h:form; 的 ui:composition 模板;嵌套表单在 Firefox4 和 Chrome12 上失败,但在其他浏览器上没有。我修复了它制作一个没有外部 h:form 的迷你模板,我可以安全地将我的登录表单注入其中。虽然这不太可能适用于您的情况,但您可以检查此项以排除嵌套表单的可能性。
      猜你喜欢
      • 2017-07-16
      • 2015-10-16
      • 1970-01-01
      • 2017-09-27
      • 1970-01-01
      • 1970-01-01
      • 2013-03-04
      • 2011-10-26
      • 2012-12-29
      相关资源
      最近更新 更多