Jsf 弹出面板不显示错误/提交
我正在使用JSF2和RichFaces4.x。我已经在弹出窗口中创建了一个登录表单。弹出窗口无法正确提交和返回错误,也不允许我登录 这是我的登录弹出窗口:Jsf 弹出面板不显示错误/提交,jsf,jsf-2,popup,richfaces,Jsf,Jsf 2,Popup,Richfaces,我正在使用JSF2和RichFaces4.x。我已经在弹出窗口中创建了一个登录表单。弹出窗口无法正确提交和返回错误,也不允许我登录 这是我的登录弹出窗口: <rich:popupPanel id="loginPopup"> <h:form id="login" class="compact-form clearfix"> <h1>Access your Account</h1>
<rich:popupPanel id="loginPopup">
<h:form id="login" class="compact-form clearfix">
<h1>Access your Account</h1>
<fieldset id="inputs">
<h:outputLabel value="Username:" for="username"/><br/>
<h:inputText id="username" value="#{viewLogin.loginName}" required="true" requiredMessage="Please enter your username">
<f:validateLength maximum="20" minimum="3" />
</h:inputText>
<a4j:outputPanel ajaxRendered="true">
<h:message for="username" />
</a4j:outputPanel>
<h:outputLabel value="Password:" for="password"/><br/>
<h:inputSecret id="password" value="#{viewLogin.password}" required="true" requiredMessage="Enter your password">
<f:validator validatorId="LoginValidator" />
<f:validateLength maximum="20" minimum="5" />
</h:inputSecret>
<a4j:outputPanel ajaxRendered="true">
<h:message for="password" />
</a4j:outputPanel>
</fieldset>
<fieldset id="actions">
<a4j:commandButton value="Submit" id="submit" action="#{viewLogin.login()}" immediate="false"
execute="username password @this"
render="username password" oncomplete="if (#{facesContext.maximumSeverity == null}) {#{rich:component('loginPopup')}.hide();}"/>
<h:commandButton value="Cancel">
<rich:componentControl operation="hide" target="loginPopup"/>
</h:commandButton>
<h:link value="Forgot password?" outcome="forgotpassword"/>
<h:link value="Forgot username?" outcome="forgotusername"/>
<h:link value="Create account" outcome="createuser"/>
</fieldset>
</h:form>
</rich:popupPanel>
访问您的帐户
现在,当我按下submit按钮时,h:inputSecret样式会发生变化,字段为no login a input type password,将显示我的密码
为什么我的登录没有提交验证/呈现错误
注意:表单在没有弹出窗口和a4j标签的情况下工作。我只是在RF 4.3.3.Final中仔细检查了您的源代码,只是删除了您正在使用的
LoginValidator,但没有提供:
<rich:popupPanel id="loginPopup" show="true">
<h:form id="login" class="compact-form clearfix">
<h1>Access your Account</h1>
<fieldset id="inputs">
<h:outputLabel value="Username:" for="username"/><br/>
<h:inputText id="username" value="#{viewLogin.loginName}" required="true" requiredMessage="Please enter your username">
<f:validateLength maximum="20" minimum="3" />
</h:inputText>
<a4j:outputPanel ajaxRendered="true">
<h:message for="username" />
</a4j:outputPanel>
<h:outputLabel value="Password:" for="password"/><br/>
<h:inputSecret id="password" value="#{viewLogin.password}" required="true" requiredMessage="Enter your password">
<f:validateLength maximum="20" minimum="5" />
</h:inputSecret>
<a4j:outputPanel ajaxRendered="true">
<h:message for="password" />
</a4j:outputPanel>
</fieldset>
<fieldset id="actions">
<a4j:commandButton value="Submit" id="submit" action="#{viewLogin.login()}" immediate="false"
execute="username password @this"
render="username password" oncomplete="if (#{facesContext.maximumSeverity == null}) {#{rich:component('loginPopup')}.hide();}"/>
<h:commandButton value="Cancel">
<rich:componentControl operation="hide" target="loginPopup"/>
</h:commandButton>
</fieldset>
</h:form>
</rich:popupPanel>
而inputSecret
字段保持机密。我的建议是
- 要添加全局
h:messages
(必须通过单击按钮重新查找)或全局rich:messages
,以检查其他可能的原因
- 还要仔细检查LoginValidator Bean是否存在任何可能的问题
- 确保没有其他PhaseListener/JavaScript主动更改DOM
有时,popupPanel与表单(嵌套表单)组合时会显示奇怪的行为。您可以通过属性DomeElementAttachment
修改DOM元素的附加
希望对您有所帮助…我刚刚在RF 4.3.3.Final中仔细检查了您的源代码,只是删除了您正在使用的LoginValidator
,但没有提供:
<rich:popupPanel id="loginPopup" show="true">
<h:form id="login" class="compact-form clearfix">
<h1>Access your Account</h1>
<fieldset id="inputs">
<h:outputLabel value="Username:" for="username"/><br/>
<h:inputText id="username" value="#{viewLogin.loginName}" required="true" requiredMessage="Please enter your username">
<f:validateLength maximum="20" minimum="3" />
</h:inputText>
<a4j:outputPanel ajaxRendered="true">
<h:message for="username" />
</a4j:outputPanel>
<h:outputLabel value="Password:" for="password"/><br/>
<h:inputSecret id="password" value="#{viewLogin.password}" required="true" requiredMessage="Enter your password">
<f:validateLength maximum="20" minimum="5" />
</h:inputSecret>
<a4j:outputPanel ajaxRendered="true">
<h:message for="password" />
</a4j:outputPanel>
</fieldset>
<fieldset id="actions">
<a4j:commandButton value="Submit" id="submit" action="#{viewLogin.login()}" immediate="false"
execute="username password @this"
render="username password" oncomplete="if (#{facesContext.maximumSeverity == null}) {#{rich:component('loginPopup')}.hide();}"/>
<h:commandButton value="Cancel">
<rich:componentControl operation="hide" target="loginPopup"/>
</h:commandButton>
</fieldset>
</h:form>
</rich:popupPanel>
而且inputSecret
字段保持机密。我的建议是
- 要添加全局
h:messages
(必须通过单击按钮重新查找)或全局rich:messages
,以检查其他可能的原因
- 还要仔细检查LoginValidator Bean是否存在任何可能的问题
- 确保没有其他PhaseListener/JavaScript主动更改DOM
有时,popupPanel与表单(嵌套表单)组合时会显示奇怪的行为。您可以通过属性DomeElementAttachment
修改DOM元素的附加
希望对您有所帮助……此外,出于测试目的,请添加一个通用的rich:messages/h:messages,以检查是否存在它抱怨的其他内容-别忘了让它重新播放。此外,出于测试目的,请添加一个通用的rich:messages/h:messages,以检查它抱怨的其他内容是否存在-别忘了让它重新播放预计起飞时间。。