3

how can i add a js file to my own composite component taglib?

I have following strucuture:

src/main/resources/META-INF/
- mytaglib.xml
- faces-config.xml

src/main/resources/META-INF/resources
- myComponent.xhtml

In myComponent.xhtml i want to add a js file. How can i do this and where i have to put this js file?

Solved - see my comment

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:cc="http://java.sun.com/jsf/composite"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core">
<head>
<title>An button with JS</title>
</head>
<body>
<cc:interface>
    <h:outputScript library="js" name="test.js" />
</cc:interface>
<cc:implementation>
    <p:commandLink value="test" onclick="myFunc();" />
</cc:implementation>
</body> 
</html> 
dasago
  • 71
  • 1
  • 5
  • 1
    Okay while playing i found the solution: The has to be in the and the js-file has to be in src/main/resources/META-INF/resources/js – dasago Jul 13 '12 at 06:04
  • 1
    You should post the answer as an answer, not as a question edit. – BalusC Jul 15 '12 at 03:01

0 Answers0