Access Control

I am implement an access control to the users.

My code is the following one:

<h:commandButton action="#{gestorAlbaranes.buscarProducto}" value="#{msgs.buscar}" rendered="#{!gestorAlbaranes.flagModificacion}" image="img/prod2venta.jpg" title="A馻de un producto al Albaran actual"/>

but,

rendered=".......", depend of acces the user,

I need send parameter to verify if rendered, is possible or not.

rendered="#{gestorA.verifyPerm("idTextBoxNombre")}"

[496 byte] By [vhsgvhsga] at [2007-10-3 0:45:25]
# 1

You might want to check out the "EL-Functors" resolver library at

http://el-functors.sourceforge.net/

Once you include the jar file from that project, you can write your "rendered" attribute as

rendered="#{gestorA.verifyPerm$['idTextBoxNombre']}"

(assuming verifyPerm is a boolean method on the "gestorA" bean with a single string parameter).

Otherwise, you can write a static method and expose it to your page as a tag library function. (you would pass both the bean and the field id to the static function).

tony_robertsona at 2007-7-14 17:40:05 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

I am try

<h:outputText value="Valor" rendered="#{gestorConexion.verificaPermiso$['Si']}"/>

my code in gestorConexion is:

public boolean verificaPermiso(String per){

if (per.equals("si") ){

return true;

}

return false;

}

The following error happens

javax.servlet.ServletException: javax.servlet.jsp.JspException: Error getting property 'verificaPermiso$' from bean of type ker.GestorConexion

the EL-Functors.jar is in the lib

swab6ea at 2007-7-14 17:40:05 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

You have 'Si' instead of 'si' in the attribute (but this won't cause the exception you got).

Did you put the "el-functors-1.0.2.jar" into your war file at "WEB-INF/lib/"?

Are you using a JSF1.2 / JSP2.1 implementation, or something else?

Did you try including the listener in your web.xml like this?:

<listener>

<listener-class>beanface.el.functor.InstallFunctorListener</listener-class>

</listener>

If you have too much trouble with it, just write your own JSP2.1 tag lib function (use the standard function library from JSTL as an example).

tony_robertsona at 2007-7-14 17:40:05 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
I am using jsp 2.0 and JSF 1.1
swab6ea at 2007-7-14 17:40:05 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
In that case, you can't use the el-functors lib, but you can still define your own tag-lib functions. See the "Expression Language Functions" section of http://www.onjava.com/pub/a/onjava/2003/11/05/jsp.html?page=2for some directions.
tony_robertsona at 2007-7-14 17:40:05 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...