有人知道如何将 Spring Security ${SPRING_SECURITY_LAST_EXCEPTION.message} “翻译/覆盖”成JSF FacesMessage,以便在 PrimeFaces p:growl组件中显示它吗?
可以用JavaScript代码做到这一点吗?
这是一些代码:
<h:form id="loginForm" prependId="false">
<p:panel id="panelLogin">
<h:panelGrid columns="2">
<h:outputLabel for="j_username" value="User" />
<p:inputText id="j_username" required="true" label="Username" name="j_username" />
<h:outputLabel for="j_password" value="Pwd" />
<p:password id="j_password" required="true" label="Password" />
</h:panelGrid>
<p:commandButton value="GO!" ajax="false"
onclick="document.loginForm.action='#{request.contextPath}/j_spring_security_check';document.loginForm.method='post';" />
</p:panel>
</h:form>
<!-- This works: -->
<c:if test="${not empty param.login_error}">
<h:outputText value="${SPRING_SECURITY_LAST_EXCEPTION.message}" />
</c:if>
<!-- Target component to show FacesMessages -->
<p:growl id="loginGrowl" />