Jsf Primefaces基于表单的登录
我有以下问题。我使用PrimeFaces4.0-SNAPSHOT、JSF2.2和Glassfish 4.0构建了一个基于表单的登录 如果我在一个单独的登录页面上使用它,那么这个登录是有效的。但是,如果我想使用上的showcase示例中所示的PF弹出窗口构建登录,我将登录,但不会转发到受保护的站点 只有当我点击以受保护区域为目标的链接,然后点击登录对话框链接时,我才会被转发 似乎只有在使用登录对话框时,我能够以某种方式将目标锁定在受保护区域时,基于表单的登录才有效。我可以使用loginBean或仅使用基于表单的身份验证来执行此操作吗?有人能告诉我一个可能的解决办法吗?我是这个环境的新手,无法找到与基于表单的登录和弹出对话框相结合的解决方案 非常感谢 触发弹出窗口的链接:Jsf Primefaces基于表单的登录,jsf,jsf-2,login,primefaces,Jsf,Jsf 2,Login,Primefaces,我有以下问题。我使用PrimeFaces4.0-SNAPSHOT、JSF2.2和Glassfish 4.0构建了一个基于表单的登录 如果我在一个单独的登录页面上使用它,那么这个登录是有效的。但是,如果我想使用上的showcase示例中所示的PF弹出窗口构建登录,我将登录,但不会转发到受保护的站点 只有当我点击以受保护区域为目标的链接,然后点击登录对话框链接时,我才会被转发 似乎只有在使用登录对话框时,我能够以某种方式将目标锁定在受保护区域时,基于表单的登录才有效。我可以使用loginBean或仅
<h:outputLink id="loginLink" value="javascript:void(0)" onclick="PF('dlg').show()" title="login" class="sign_in" >Sign in here!</h:outputLink>
在这里登录!
登入表格:
<p:dialog id="logindialog" header="Login" widgetVar="dlg" resizable="false">
<h:form id="login" onsubmit="document.getElementById('login').action='j_security_check';" prependId="false">
<p:growl id="growl" showDetail="true" life="3000" />
<h:panelGrid columns="3" cellpadding="5">
<h:outputLabel for="j_username" value="Username:" />
<p:inputText id="j_username" />
<p:tooltip for="j_username" value="Bitte Benutzernamen eingeben" showEffect="fade" hideEffect="fade" />
<h:outputLabel for="password" value="Password:" />
<p:password id="j_password" />
<p:tooltip for="j_password" value="Bitte Passwort eingeben" showEffect="fade" hideEffect="fade" />
<f:facet name="footer">
<div style="text-align: center">
<p:commandButton id="submit" value="Login" ajax="false" oncomplete="app/index?faces-redirect=true"/>
</div>
</f:facet>
</h:panelGrid>
</h:form>
</p:dialog>
web.xml
<security-constraint>
<display-name>Mofnug Pages</display-name>
<web-resource-collection>
<web-resource-name>Protected Mofnug Area</web-resource-name>
<description></description>
<url-pattern>/faces/app/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>HEAD</http-method>
<http-method>PUT</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
<http-method>DELETE</http-method>
</web-resource-collection>
<auth-constraint>
<description/>
<role-name>admin</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>mofnug</realm-name>
<form-login-config>
<form-login-page>/faces/index.xhtml</form-login-page>
<form-error-page>/faces/loginerror.xhtml</form-error-page>
</form-login-config>
</login-config>
Mofnug页面
保护区
/人脸/应用程序/*
得到
邮递
头
放
选择权
痕迹
删除
管理
没有一个
形式
莫夫努格
/faces/index.xhtml
/faces/loginerror.xhtml
您是否在打开对话框的输出链接上尝试了类似oncomplete=“/app/index”的操作