EventsRenderer.encodeEventListeners(js, listenersByType,
EventsRenderer.encodeEventListeners(js, js .getComponentVarName(), listenersByType,
    protected void encodeEndJavaScript(IHtmlWriter writer)            throws WriterException {        IHtmlRenderContext htmlRenderContext = getHtmlRenderContext(writer);        UIComponent component = htmlRenderContext.getComponent();        IJavaScriptWriter js = htmlRenderContext.removeJavaScriptWriter(writer);        if (js != null) {            // Le Javascript writer a �t� referm�, on ignore dans ce cas ...            js = null;        }        boolean enableJavascript = false;        MethodBinding action = null;        Map listenersByType = null;        if (ENCODE_EVENT_ATTRIBUTE == false) {            // On recherche l'attribut Action            if (component instanceof UICommand) {                action = ((UICommand) component).getAction();                if (action != null) {                    enableJavascript = true;                }            }            // On recherche les ActionListeners            listenersByType = ListenerTools.getListenersByType(                    ListenerTools.JAVASCRIPT_NAME_SPACE, component);            if (listenersByType.size() > 0 || action != null) {                enableJavascript = true;            }        }        IJavaScriptRenderContext javascriptRenderContext = htmlRenderContext                .getJavaScriptRenderContext();        javascriptRenderContext.computeRequires(writer, this);        if (javascriptRenderContext.isRequiresPending()) {            // Rien on peut utiliser le tag v:init !            enableJavascript = true;        }        if (js == null) {            if (enableJavascript == false) {                enableJavascript = writer.isJavaScriptEnabled();            }            if (enableJavascript) {                js = htmlRenderContext.getJavaScriptWriter(writer, this);            }        }        if (js != null) {            if (writer.isJavaScriptStubForced()) {                js.ensureInitialization();            }            try {                encodeJavaScript(js);                if ((listenersByType != null && listenersByType.isEmpty() == false)                        || action != null) {                    String actionListenerType = null;                    if (action != null) {                        actionListenerType = getActionEventName(ListenerTools.JAVASCRIPT_NAME_SPACE);                        if (actionListenerType == null) {                            throw new FacesException(                                    "Unknown listenerType for action=\""                                            + action.getExpressionString()                                            + "\".");                        }                    }                    EventsRenderer.encodeEventListeners(js, listenersByType,                            actionListenerType);                }                if (hasComponenDecoratorSupport()) {                    IComponentDecorator componentDecorator = getComponentDecorator(writer                            .getComponentRenderContext());                    if (componentDecorator != null) {                        componentDecorator.encodeJavaScript(js);                    }                }            } finally {                js.end();            }        }    }