ここで言及した問題を解決するために別のアプローチを試みて、いくつかのフォーマット関数を使用する facelets taglib を作成しました。
通常のページでは正常に機能しますが、複合コンポーネントの場合、関数は実行されず、エラーはスローされません。
タグライブラリ ファイル:
<?xml version="1.0" encoding="UTF-8"?>
<facelet-taglib
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
version="2.0">
<namespace>http://www.spdata.com.br/jsf</namespace>
<composite-library-name>spd</composite-library-name>
<function>
<function-name>leftJustifyWithZeros</function-name>
<function-class>
br.com.spdata.util.Formatter
</function-class>
<function-signature>
String leftJustifyWithZeros(java.lang.String, java.lang.Integer)
</function-signature>
</function>
<function>
<function-name>replaceNewLineWithBrTag</function-name>
<function-class>
br.com.spdata.util.Formatter
</function-class>
<function-signature>
String replaceNewLineWithBrTag(java.lang.String)
</function-signature>
</function>
</facelet-taglib>
複合コンポーネント:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:p="http://primefaces.org/ui"
xmlns:cc="http://java.sun.com/jsf/composite"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:spd="http://www.spdata.com.br/jsf"
>
<cc:interface>
<cc:attribute name="value" required="true" />
</cc:interface>
<cc:implementation>
<h:outputText
id="#{cc.attrs.id == null ? 'visualizar' : cc.attrs.id}"
value="Visualizar"
rendered="#{cc.attrs.value != null and not empty cc.attrs.value}"
/>
<p:tooltip
value="#{spd:replaceNewLineWithBrTag(cc.attrs.value)}"
for="#{cc.attrs.id == null ? 'visualizar' : cc.attrs.id}"
/>
</cc:implementation>
</html>
私は何が欠けていますか?
ありがとう、フィリップ