I am trying to develop my own messages component using facelets, to
rendered different kind of messages in diferent divs.
My first approach was 4 divs with 4 t:messages and use
style="display:none;" for the messages I don't like to display:
For example, for InfoMessages
<t:messages id="ServerMensajesInfo" rendered="#{myfn:hasInfos()}"
showDetail="true" showSummary="false" replaceIdWithLabel="true"
layout="list" fatalStyle="display:none;" errorStyle="display:none;"
warnStyle="display:none;" infoStyle="display:block;">
This is a bit dirty, so I was trying to do it better:
<ul id="ServerMensajesInfo">
<li jsfc="ui:repeat" value="#{myfn:getInfos()}" var="info">
<span id="ServerMensajesInfo">#{info}</span>
</li>
</ul>
myfn:getInfos() returns the info messages.
It is perfect, but it of course did not replace input ids with labels.
I think I could do it if I would have access to the tree from
FacesContext.
There is a function:
facesContext.getClientIdsWithMessages()
which gives me all the "clientId" which have messages.
Then, I get all the messages form all the clientIds using:
facesContext.getMessages(clientId);
No, if I have clientId as a String, is there any way to access the tree
and find the component with that clientId, and then, find its label,
with for="clientId"?