将 MyFaces Tomahawk 添加到 NetBeans 中的 JSF 2.0 项目
我正在尝试将 MyFaces Tomahawk 添加到 NetBeans 中的 JSF 2.0 项目中。我读了很多评论,其中提到了如何做到这一点,但它不起作用,我已经完成了以下步骤:
1° 将从 Tomahawk 网站下载的所有 jar 库复制到 /%ProjectFolder%/web/WEB-INF/lib 中(我没有得到了 lib 文件夹,所以我创建了它)
2° 使用 netbeans 中的 Properties/Libraries/Add 文件夹将库添加到项目中
3° 将以下代码添加到 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° 添加到index.xhtml html 标记中包含以下行:
xmlns:t="http://myfaces.apache.org/tomahawk"
嗯,我想我不需要做更多的事情,但是当我执行最后一步时,NetBeans 告诉我:“找不到此命名空间的库”。
我确信我做得很糟糕,但我不知道我需要做什么......一些想法?
我希望这篇文章可以作为教程,因为我认为它是必要的。
谢谢^^
编辑:
我发现了错误:我们需要另一个步骤:
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
web.xml 末尾有这个吗?
您的代码中似乎缺少(第 3 步)
您还应该检查 servlet 部分是否不重复。
它对我来说效果很好。
Do you have this at the end of web.xml?
Seems missing in your code (Step 3)
Also you should check that the servlet section is not repeated.
It works fine for me.
我遇到了同样的问题,并通过以下步骤解决了:
库 ->添加 Jar
并仅选择下载的 tomahawk.jar配置扩展过滤器,如下所示:
<前><代码> <过滤器>
<过滤器名称>MyFacesExtensionsFilter
<过滤器类>org.apache.myfaces.webapp.filter.ExtensionsFilter
<初始化参数>
<参数名称>uploadMaxFileSize
<参数值>20m
<过滤器映射>
Faces Servlet
<过滤器名称>MyFacesExtensionsFilter
<过滤器映射>
/faces/myFacesExtensionResource/*
Faces Servlet
javax.faces.webapp.FacesServlet
<过滤器名称>MyFacesExtensionsFilter
<启动时加载>11
确保扩展过滤器的 servlet-name 值与 Faces servlet 的名称匹配。
添加了此导入
xmlns:t="http://myfaces.apache.org/tomahawk"
问题可能与您导入库的方式有关。
I had the same problem and solved by following just the following steps:
Libraries -> Add Jar
and selected just the downloaded tomahawk.jarConfigured the Extensions filter like this:
making sure that the servlet-name value of the extension filter matches the name of the Faces servlet.
Added this import
xmlns:t="http://myfaces.apache.org/tomahawk"
Probably the problem is about the way you imported the libraries.