You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Don Forbes (JIRA)" <de...@myfaces.apache.org> on 2010/04/21 11:52:53 UTC
[jira] Created: (TRINIDAD-1791) tr:message component not displaying
messages submitted using FacesContext.addMessage
tr:message component not displaying messages submitted using FacesContext.addMessage
------------------------------------------------------------------------------------
Key: TRINIDAD-1791
URL: https://issues.apache.org/jira/browse/TRINIDAD-1791
Project: MyFaces Trinidad
Issue Type: Bug
Components: Components
Affects Versions: 1.2.12-core
Environment: Ubuntu Koala, JDeveloper 11.1.1.2.0, FireFox 3.5.9.
Reporter: Don Forbes
Priority: Minor
A message added using FacesContext.addMessage(String id, FacesMessage) for id "myId" does not display in the (explicit or implicit) tr:message field for the component defined with id="myId". However, the message does display correctly in the tr:messages component for the page.
I added diagnostic displays to method org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.MessageRenderer.encodeAll and found that the problem seems to be that this method is using a qualified key (the variable "forId", obtained using MessageUtils.getClientIdFor). E.g. it tries to retrieve the message using key forid="j_id7:myId", whereas the message was stored with the key "myId". I was able to resolve the problem by trying an alternative forId key with the ""j_id:" prefix stripped off, as follows:
After line 113:
FacesMessage facesMessage = MessageUtils.getFacesMessage(context, forId);
... I simply added the following alternative lookup code to get it working.
if (facesMessage == null) {
String altForId = null;
if (forId != null && forId.contains(":")) {
final String[] split = forId.split(":");
altForId = split[split.length - 1];
}
facesMessage = MessageUtils.getFacesMessage(context, altForId);
}
Am I supposed to be resolving the id myself (myId -> j_id7:myId) before the addMessage call? I doubt it because this would seem like a lot of overhead and unnecessary exposure of Trinidad internals.
Thank you,
Don
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.