1

Im trying to add MyFaces Tomahawk to my JSF 2.0 project in NetBeans. I readed a lots of coments where it says how to do it but it doesnt work there are the steps i have done:

1º Copy all jar's libraries downloaded from Tomahawk website in /%ProjectFolder%/web/WEB-INF/lib (i havent got the lib folder so i created it)

2º Add the library to the proyect using Properties/Libraries/Add folder in netbeans

3º Add the following code to web.xml:

 <filter>
  <filter-name>extensionsFilter</filter-name>
  <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
 </filter>

 <filter-mapping>
  <filter-name>extensionsFilter</filter-name>
  <servlet-name>Faces Servlet</servlet-name>
 </filter-mapping>

 <filter-mapping>
  <filter-name>extensionsFilter</filter-name>
  <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
 </filter-mapping>

 <servlet>
  <servlet-name>Faces Servlet</servlet-name>
  <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

4º Add to index.xhtml the following line in html tag:

xmlns:t="http://myfaces.apache.org/tomahawk"

Well, i think i dont need to do more but when i do the last step, NetBeans say me:"No library found for this namespace".

Im sure im doing it bad but i dont know what i need to do..... some ideas?

I hope this post work as a tutorial because i think its necesary.

Thanks ^^

EDIT:

I founded the error: we need another step:

5º You have to download This example file. Its a collection of examples in a War file. Open it with winrar or similar and unrar myfaces-example-simple20-1.1.11 folder. After that, go to myfaces-example-simple20-1.1.11\WEB-INF\src\META-INF\ directory and copy all files in your web/META-INF/. Then, netbeans will show you the help and autofill options.

Roberto
  • 757
  • 1
  • 12
  • 21
  • I tried with netbeans 7.0.1 and it works without problem. What I did was add a new library, add the jars and use them on the application. Maybe it is something related to put the dependencies under WEB-INF/lib folder. – lu4242 Dec 10 '11 at 14:55
  • So, your concrete problem is that Netbeans can't autocomplete the tags, while the application by itself **runs perfectly fine**? You should really have made that more clear. – BalusC Dec 11 '11 at 13:40

2 Answers2

0

Do you have this at the end of web.xml?

    <load-on-startup>1</load-on-startup>
</servlet>

Seems missing in your code (Step 3)

Also you should check that the servlet section is not repeated.

It works fine for me.

andrewsi
  • 10,807
  • 132
  • 35
  • 51
JuanBQ
  • 1
0

I had the same problem and solved by following just the following steps:

  1. Put the tomahawk.jar in my war. I achieved this right-clicking on the war -> Properties. Then Libraries -> Add Jar and selected just the downloaded tomahawk.jar
  2. Configured the Extensions filter like this:

     <filter>
        <filter-name>MyFacesExtensionsFilter</filter-name>
        <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
        <init-param>
            <param-name>uploadMaxFileSize</param-name>
            <param-value>20m</param-value>
        </init-param>
    </filter>
    
    <filter-mapping>
        <filter-name>MyFacesExtensionsFilter</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>
    
    <filter-mapping>
        <filter-name>MyFacesExtensionsFilter</filter-name>
        <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
    </filter-mapping>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    

    making sure that the servlet-name value of the extension filter matches the name of the Faces servlet.

  3. Added this import xmlns:t="http://myfaces.apache.org/tomahawk"

Probably the problem is about the way you imported the libraries.

Verdi
  • 84
  • 2
  • 10