Custom component: include a JavaScript file once
Hello,
I'm developing a custom component. At the moment my renderer includes with every instance of my component JavaScript code in the body.
Example (Pseudocode):
JSF:
<html>
<body>
<my:component />
<my:component />
</body>
</html>
Current rendered HTML:
<html>
<body>
<input type="text" value="" onClick="function()" />
<script type="text/javascript">function(){}</script>
<input type="text" value="" onClick="function()" />
<script type="text/javascript">function(){}</script>
</body>
</html>
Is there a way to include my JavaScript code once in the header instead of including in the body for every instance.
Target HTML:
<html>
<head>
<script type="text/javascript">function(){}</script>
</head>
<body>
<input type="text" value="" onClick="function()" />
<input type="text" value="" onClick="function()" />
</body>
</html>
Regards
Martin

