On 7/31/06, Jorge Vásquez <[EMAIL PROTECTED]> wrote:
Very interesting!! Two new questions regarding valid EL expressions: 1. How exactly will the syntax and procedure be for using a Facelet function as rendered condition?
Here's an example that was just posted on the mailing list. To use it, it'd be <html xmlns="http://www.w3.org/1999/xhtml" xmlns:myFunction="http://www.prosystemsit.de/le" .... rendered="#{myFunction:test('value')}" Note that this particular function doesn't return a boolean, so this would be an error, but it does demonstrate all of the pieces. ---------- Forwarded message ---------- From: Marcus Schmidke <[EMAIL PROTECTED]> Date: Jul 27, 2006 7:09 AM Subject: Antwort: Re: Re: User defined LE functions To: MyFaces Discussion <users@myfaces.apache.org> web,xml: <context-param> <param-name>facelets.LIBRARIES</param-name> <param-value>/WEB-INF/tags/le.taglib.xml</param-value> </context-param> le.taglib.xml: <!DOCTYPE facelet-taglib PUBLIC "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN" "http://java.sun.com/dtd/facelet-taglib_1_0.dtd"> <facelet-taglib> <namespace>http://www.prosystemsit.de/le</namespace> <tag> <tag-name>test</tag-name> <source>test.xhtml</source> </tag> <function> <function-name>wert</function-name> <function-class> de.prosystemsit.leistungserfassung.controller.Functions</function-class> <function-signature>java.lang.String wertInSpalte(java.lang.String)</function-signature> </function> </facelet-taglib> Functions.java: package de.prosystemsit.leistungserfassung.controller; public class Functions { public static String wertInSpalte(String s) { return "Hallo Welt"+s; } }
2. Is it possible to obtain elements of Lists at specific positions and compare them with fixed values. Ex: rendered="#{mb.myList[0] eq 'element1'}"
Sure, if you write a myFunction:listGet(mb.myList, 0) function. rendered="#{myFunction:listGet(mb.myList, 0) eq 'element1'}"