1
我發現標籤<sec:IfAnyGranted roles="ROLE_ADMIN" >
被忽略,.xhtml
頁面上我收到以下消息:爲什麼我的`<sec:IfAnyGranted roles =「ROLE_ADMIN」>標記被忽略?
The attribute **roles** is not defined in Component's interface
我發現標籤<sec:IfAnyGranted roles="ROLE_ADMIN" >
被忽略,.xhtml
頁面上我收到以下消息:爲什麼我的`<sec:IfAnyGranted roles =「ROLE_ADMIN」>標記被忽略?
The attribute **roles** is not defined in Component's interface
標準的Spring Security的taglib不與JSF工作。可以使用the Facelets version。
然後可以使用sec:ifAnyGranted()
功能(未標記)的表達式內:
<p:menubar xmlns="http://www.w3.org/1999/xhtml"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:sec="http://www.springframework.org/security/facelets/tags">
...
<p:submenu label="#{msgs['menu.report']}"
rendered="#{sec:ifAnyGranted('ROLE_ADMIN, ROLE_REPORTER')}">
這一塊的工作代碼,顯示一個菜單隻爲給定的用途。 請注意,我不使用the default Spring JSP taglib而是Facelets版本。