users@javaserverfaces.java.net

How do I define a function to be used with Unified Expression Language in JSF?

From: Todd Patrick <Todd.Patrick_at_dtn.com>
Date: Tue, 18 Mar 2008 12:03:41 -0500

I'm Reading the section "Unified Expression Language" in the Java EE Tutorial. The JSP expression language allows you to define a function that can be invoked in an expression. What I'd like to do is the following: 1.) Within a h:dataTable I have a JSF component that looks like this: <h:dataTable var="row" value="#{mybean.clientList}"> ... <h:outputText value="#{row.clientCreated}"/> "mybean" is in request scope and the clientList is a List<Client>. The clientCreated property returns a Long which is the milliseconds of the Date Time of when the Client was added. 2.) I have a public String method in the same "mybean" that converts milliseconds to a human readable date time format. public String myClientTime(Long milliseconds){ } 3.) Is it possible to do something like this? <h:dataTable var="row" value="#{mybean.clientList}"> ... <h:outputText value="#{mybean.myClientTime(row.clientCreated)}"/> I don't control the List<Client> that is provided to the value of the h:dataTable, so I can't convert the milliseconds to a human readable format before I display the value in the h:outputText component. I appreciate any suggestions on the best way to do this. Thanks, --Todd Todd Patrick Web Developer DTN 9110 West Dodge Road, Suite 200 Omaha, NE 68114 todd.patrick_at_dtn.com Phone: 402-255-8155 Fax: 402-255-8825 www.dtn.com DTN Smarter Decisions ----------------------------------------- NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.