首页 > 解决方案 > 为什么 JSF 不能在带有 @CustomFormAuthenticationMechanismDefinition 的登录页面中工作?

问题描述

我正在尝试使用新的 Java EE 8 安全性。

如果我不在登录页面中使用 JSF,它就可以工作。如果我使用 JSF,则不会显示任何内容,因为表单位于<h:form>标记(JSF 标记)内。表单外页面的 EL 表达式显示为“ #{bean.property}”,而不是属性的值。

如果我直接在浏览器中输入登录页面的 URL,页面会正确显示。如果在我尝试访问受保护页面时显示该页面,则无法正确显示。

我尝试使用 Chrome 和 Firefox。由于 Java EE 为登录页面的 URL 添加了“https”,我不得不添加一个异常。是问题吗?

该应用程序使用 Payara 5.182。

页面代码:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:ui="http://java.sun.com/jsf/facelets">

<ui:composition template="/formations/templateBase.xhtml">
<ui:define name="title">
  <h:outputText value="#{bundle.Login_Titre}"></h:outputText>
</ui:define>
<ui:define name="content">
  #{'HELLO!'} <!-- JUST TO TEST -->
  <h:form id="form">
    <p><h:outputText value="#{bundle.Login_Message}"/></p>
    <h:outputText value="#{bundle.identifiant}"/>
    <h:inputText id="login" value="#{loginBean.name}"/>
    <h:outputText value="#{bundle.password}"/>
    <h:inputSecret id="password"
                   value="#{loginBean.password}"/>
    <p><h:commandButton value="#{bundle.Login_Login}" action="#{loginBean.login}"/></p>
  </h:form>
  </ui:define>
  </ui:composition>
 </html>

标签: jsfpayarajava-ee-8

解决方案


推荐阅读