users@javaserverfaces.java.net

JSF 1.2_04: Still unable to display FacesMessage from Java code for a h:message with an ID

From: Todd Patrick <Todd.Patrick_at_dtn.com>
Date: Tue, 13 Mar 2007 10:43:38 -0500

In my JSP, I have the following: <h:message id="searchErrorFilter" for="filter" showDetail="true" showSummary="true" styleClass="Error"/> I've followed "Call Application.getMessageBundle(). If non-null, locate the named ResourceBundle, using the Locale from the current UIViewRoot and see if it has a value for the argument messageId. If it does, treat the value as the summary of the FacesMessage. If it does not, or if Application.getMessageBundle() returned null, look in the ResourceBundle named by the value of the constant FACES_MESSAGES and see if it has a value for the argument messageId. If it does, treat the value as the summary of the FacesMessage. If it does not, there is no initialization information for the FacesMessage instance." But, it looks like I don't have an initialization happening for the FacesMessage in my Backing Bean. In my Java Code, I have the following method: private void doElementSearch(String _tbTransactID){ FacesContext context = FacesContext.getCurrentInstance(); FacesMessage message = new FacesMessage(); List<ElementRow> elementResults; List<ElementNode> elementRoot; try { elementResults = transactionBrowserSessionRemote.doElementSearch(_tbTransactID); elementRoot = new ArrayList<ElementNode>(); if (elementResults.isEmpty()) { ElementNode elementRootNullItem = new ElementNode(); elementRoot.add(elementRootNullItem); } else { elementRoot.clear(); for (ElementRow elementRow : elementResults) { ElementNode elementRootItem = new ElementNode(elementRow.getElementKey(), elementRow.getElementKey()); elementRoot.add(elementRootItem); } } /** * This controls whether to display the folder icon or not for a leaf node */ this.setElementModel(new ChildPropertyTreeModel(elementRoot, "children") { public boolean isContainer() { return ((ElementNode)getRowData()).getChildCount() > 0; } } ); } catch (PetroException ex) { message.setSeverity(FacesMessage.SEVERITY_ERROR); message.setSummary(ex.getMessage()); context.addMessage(null, message); context.getCurrentInstance().renderResponse(); logger.error("Transaction Browser Exception - Element Tree:", ex); } context.renderResponse(); } When I step through the code in Netbeans 5.5, context does get the message object added, so I can't figure out why I can't display the message's summary in the h:message component? I'd greatly appreciate any help, I've spent a good chunk of time on this issue already. Thanks, --Todd ----------------------------------------- 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.