1

ユーザーロールのoutputTextボックスに基づいてJSFでoutputTextをレンダリングする必要があります。

<h:outputText id="citizenaddress" value="#{customerView.customerCurrentAddress}" escape="false" rendered="#{facesContext.externalContext.userInRole('isabletoGetCitizenAddress')}"></h:outputText>

web.xmlは次のとおりです。

<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

例外は次のとおりです。

javax.el.ELException: /info/citizenInfo.xhtml @42,193 rendered="#{facesContext.externalContext.userInRole('isabletoGetCitizenAddress')}": Method userInRole not found
4

2 に答える 2

1

メソッドはisUserInRole(String)です。

Beanプロパティの式の規則をメソッドの構文と混同している可能性があります。

表現は次のようにすべきだと思います。

#{facesContext.externalContext.isUserInRole('isabletoGetCitizenAddress')}
于 2013-01-10T12:29:04.923 に答える
0

の二重引用符を一重引用符に変更してみてくださいisabletoGetCitizenAddress<h:outputText id="citizenaddress" value="#{customerView.customerCurrentAddress}" escape="false" rendered="#{facesContext.externalContext.userInRole('isabletoGetCitizenAddress')}"></h:outputText>

于 2013-01-10T12:23:19.813 に答える