I have a composite control as below;
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:composite="http://java.sun.com/jsf/composite" xmlns:h="http://java.sun.com/jsf/html">
<composite:interface>
    <composite:attribute name="validatorId"/>
    <composite:attribute name="message"/>        
</composite:interface>
<composite:implementation>
    <div>                   
        <script type="text/javascript">
             function #{cc.attrs.validatorId}(){alert('why is it not working :(');};
        </script>                                
        <div style="background-color: #F2DEDE;color: #b94a48;border-style: solid;border-color: #FAC3CB;border-width: 1.8px;font-family: Arial;
              font-size: 12px;height:17px;vertical-align: middle;padding-left: 8px;padding-right: 8px;padding-top: 2px;display: none;"
              id="#{cc.attrs.validatorId}">
            #{cc.attrs.message}
            <img src="images/close-mini.png" style="cursor: pointer;padding-left: 5px;"/>            
        </div>
    </div>
</composite:implementation> </html>
This control is placed in a xhtml file.The javascript and composite controls are rendering as the expected way. But when a request is made to xhtml following exception occurs at Glassfish Server :
java.lang.IllegalStateException: PWC3999: Cannot create a session after the response has been committed.
What can be the reason? When I remove the javascript function exception doesn't occurs.
 
    