简体   繁体   中英

rendered in JSF with method parameter

I am creating a xhtml that uses JSF. I have a class called SeguridadControllerBean.java which contains a method isRol (String role) This method I want to call from the XHTML by passing the parameter as follows:

<h:outputText value = "The Producers"
   rendered = "#{seguridad.rol ['administrator']}" />

But the problem is that when you arrive at this screen, it tells me the following:

javax.faces.el.PropertyNotFoundException: /WEB-INF/view/template.xhtml @18,54 rendered="#{seguridad.rol['administrator']}": Bean: org.javassist.tmp.java.lang.Object_$$_javassist_559, property: rol

Now, if I remove the parameter and the method isRol () does not receive any parameters, it works.

Change your XHTML like this...

     <h:outputText value = "The Producers"
   rendered = "#{seguridad.rol('administrator')}" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM