Cannot display facesMessages from custom action.

I've created a simple button widget that fires an action, passing a String to the action:

<div 

xmlns=“http://www.w3.org/1999/xhtml” xmlns:nxthemes=“http://nuxeo.org/nxthemes” xmlns:ui=“http://java.sun.com/jsf/facelets” xmlns:f=“http://java.sun.com/jsf/core” xmlns:h=“http://java.sun.com/jsf/html” xmlns:nxu=“http://nuxeo.org/nxweb/util” xmlns:nxdir=“http://nuxeo.org/nxdirectory” xmlns:nxl=“http://nuxeo.org/nxforms/layout” xmlns:c=“http://java.sun.com/jstl/core” xmlns:a4j=“http://richfaces.org/a4j”>

          <a4j:commandButton

          id="#{widget.id}_btn_besPMPTOT"
          value="Stop Prep"
          action="#{besPMPTOT.pmpStop('Prep')}"
          styleClass="button">
        </a4j:commandButton>            

I've used the Advanced Widget section in Studio to insert this widget into an edit view of a document. The associated JAVA action was generated with nuxeo IDE. I changed the accept() in the generated action class method to return false so I did not see the tabs. The button works except any message generated by the JAVA actions to facesMessages is not displayed. An error of: [javax.enterprise.resource.webcontainer.jsf.lifecycle] jsf.non_displayed_message is displayed in the log file.

Did setting the return value on the accept method(filter) turn off the ability to send messages to “faces” for display to the user? Do I need a different category in the action .xml file? I currently have the standard SUBVIEW_UPPER_LIST as the category. Should I be using the Nuxeo nxa4j instead of a4j in my button widget?

0 votes

1 answers

1238 views

ANSWER



hi,

sorry, not sure i understood correctly what you're trying to do, but that kind of message shows that a component is not re-rendered. Adapting the corresponding attribute on the a4j link so the component with a message is rendered should do the trick

0 votes



I am trying to issue a message, using Java facesMessages, to the user, from inside custom action linked to a button generated by the widget above. In this case the custom action is: besPMPTOT.pmpStop('Prep').
07/30/2012

Ok, you can issue a global message, or attach it to a JSF component using its id.

In any case, you'll need a JSF component displaying this message, and make sure it is re-rendered on ajax action.

07/31/2012