How to add MyFaces support to a Sun JSF RI application
2008-01-04 14:45
369 查看
How to add MyFaces support to a Sun JSF RI application
Introduction
MyFaces does have its own implementation of the JSF specification. But if you already have a working JSF web app based on the Sun JSF 1.1 reference implementation, you may want stay with it. The following describes the minimal steps necessary to add the MyFaces extensions to a Sun JSF 1.1 web app.Versions these steps should work for:
Sun JSF 1.1.01
MyFaces 1.0.9 (success with version 1.1.1 has also been reported)
Notes:
The MyFaces version of Tiles Support will not work with this approach, but other components should work fine.
Steps
Put the myfaces-extensions.jar and the commons-fileupload-1.0.jar in your WEB-INF/lib directory (or in the classpath of your application server.)Add the following lines to your web.xml file:
<!-- Extensions Filter --> <filter> <filter-name>extensionsFilter</filter-name> <filter-class> org.apache.myfaces.component.html.util.ExtensionsFilter </filter-class> <init-param> <description> Set the size limit for uploaded files. Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB </description> <param-name>uploadMaxFileSize</param-name> <param-value>100m</param-value> </init-param> <init-param> <description> Set the threshold size - files below this limit are stored in memory, files above this limit are stored on disk. Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB </description> <param-name>uploadThresholdSize</param-name> <param-value>100k</param-value> </init-param> <!-- <init-param> <param-name>uploadRepositoryPath</param-name> <param-value>/temp</param-value> <description>Set the path where the intermediary files will be stored. </description> </init-param> --> </filter> <filter-mapping> <filter-name>extensionsFilter</filter-name> <url-pattern>*.faces</url-pattern> </filter-mapping> <filter-mapping> <filter-name>extensionsFilter</filter-name> <url-pattern>/faces/*</url-pattern> </filter-mapping>
Note: you may need to change the url-pattern to match whatever pattern you are using (e.g. *.jsf instead of *.faces).
Add the following to your JSP page in order to use one of the MyFaces custom components:
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
That's it! You should now be able to add MyFaces components to your .jsp page.
相关文章推荐
- How to add application to right click menu in Windows
- How to add / install JSON support to PHP on CentOS in 10 Steps
- How to discover memory usage of my application in Android
- How to add custom title bar to android application
- 【iMX6QD】 How to Add 24-bit LVDS Support in Android
- How do i prevent end users from connecting to the database other than my application?", version 8.1.5
- How to discover memory usage of my application in Android
- How to Add Windows 7 “God Mode” Shortcut in My Computer Context Menu?
- How to discover memory usage of my application in Android
- How do I add a directory to my include path (@INC) at runtime?
- How to Analyze Problems Related to Internal Errors (ORA-600) and Core Dumps (ORA-7445) using My Oracle Support (文档 ID 260459.1)
- Liferay 7 CE: How to add support for Oracle DB
- How to support MFC features in Win32 application?
- HTML codes: How do I add a "click here to refresh this page" button on my webpage
- How To Add Google Apps and ARM Support to Genymotion v2.0+
- How to implement a many-to-many relationship using Linq to Sql ? Part II : add/remove support (转)
- How do I add a directory to my include path (@INC) at runtime?
- How do I add capabilities to my executable in qt for symbian?
- How do I use locales and resource bundles to internationalize my application?
- How to launch App Store from my iPhone application?