OK I fix some issues, I feel I am close to find the solution but it doesn’t come.
OK As the first comment, I create the following Class in package we will call pkg
public class Common {
public static String getDateFormat(String oldDateString) throws ParseException {
final String OLD_FORMAT = "yyyy-MM-dd";
final String NEW_FORMAT = "dd/MM/yyyy";
String newDateString;
SimpleDateFormat sdf = new SimpleDateFormat(OLD_FORMAT);
Date d = sdf.parse(oldDateString);
sdf.applyPattern(NEW_FORMAT);
newDateString = sdf.format(d);
return newDateString;
}
}
Then I migrate my view to be in JSF 2. I can see a xhtml file for my view (instead of a xml file).
Then I create a file in /WEB-INF called common.taglib.xml like this :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE facelet-taglib PUBLIC
"-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
"https://facelets.dev.java.net/source/browse/*checkout*/facelets/src/etc/facelet-taglib_1_0.dtd">
<facelet-taglib xmlns="http://java.sun.com/JSF/Facelet">
<namespace>http://url-which-doesnt-exist-in-relaity-but-exist-for-my-namespace</namespace>
<function>
<function-name>getDateFormat</function-name>
<function-class>pkg.Common</function-class>
<function-signature>java.lang.String getDateFormat(java.lang.String)</function-signature>
</function>
</facelet-taglib>
As you see, the url : http://url-which-doesnt-exist-in-relaity-but-exist-for-my-namespace is not a real url it is just a namespace.
Then I modify my web.xml file and add the following tags :
<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/common.taglib.xml</param-value>
</context-param>
Then in my xhtml view fille I add the following namespace :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:caf_f="http://webmethods.com/jsf/caf/core"
xmlns:caf_h="http://webmethods.com/jsf/caf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
[b]xmlns:a="http://url-which-doesnt-exist-in-relaity-but-exist-for-my-namespace"[/b]>
....
And In my variable Toto in Binding view I add the following expression :
#{a:getDateFormat("2018-01-01")}
But it seems that doesn’t work :
In full.log file in server, I have the following error :
javax.el.ELException: Function ‘a:getDateFormat’ not found
So I guess I forgot something, maybe it is the url in namespace but I don’t know how to fix it.
#webMethods-BPMS#MWS-CAF-Task-Engine#webMethods