AnsweredAssumed Answered

Custom action : how to intercept the validation phase of JSF

Question asked by zomurn on Dec 1, 2008
Latest reply on Dec 3, 2008 by zomurn
Hello,

I have a custom action like this :

<!– Etat traiter –>
         <action id="traiter_action_id">
            <permissions>
               <permission allow="true">Write</permission>
            </permissions>
            <evaluator>
               org.alfresco.module.msc.action.evaluator.MscTraiterEvaluator
            </evaluator>
            <label-id>traiter_action_label_id
            </label-id>
            <image>/images/icons/approve.gif
            </image>
            <action>browse</action>
            <action-listener>#{MscAction.setupContentAction}
            </action-listener>
            <params>
               <param name="nodeRef">#{actionContext.nodeRef}
               </param>
               <param name="actionId">traiter_action_id</param>
            </params>
         </action>

The problem is that when I click on the action, the associated action-listener is situated in the "Invoke Application" phase of JSFrequest  life cycle.
The problem is that in this phase we can't add FacesMessage to the FacesContext because, just at the end of this action listener method, the response.sendRedirect() instruction is executed and so a new FacesContext is created resulting in that the FacesMessage is then lost !
How to intercept the previous phase (I need to be in validation phase so as to be able to throw error message in web client).

Thanks.

Outcomes