• Embed Doc
  • Readcast
  • Collections
  • CommentGo Back
\u00a9 2005 Marty Hall
htt
p
://courses.coreservlets.com/ -- Hands-on, customized trainin
g
for Java, servlets, JSP, Struts, and JSF.

JSF: The MyFaces
Custom Components
(Tomahawk)

Core Servlets & JSPbook: www.coreservlets.com
More Servlets & JSPbook: www.moreservlets.com
Servlet/JSP/Struts/JSF Training: courses.coreservlets.com
\u00a9 2005 Marty Hall
htt
p
://courses.coreservlets.com/ -- Hands-on, customized trainin
g
for Java, servlets, JSP, Struts, and JSF.
For live JSF training, please see
JSP/servlet/Struts/JSF training courses at
http://courses.coreservlets.com/.
Taught by the author ofCore Servlets and JSP,Mor e
Servlets and JSP, and this tutorial. Available at
public venues, or customized versions can be held
on-site at yourorganization.
4
J2EE training and tutorials: http://www.coreservlets.com
Topics in This Section

\u2022Getting the MyFaces components
\u2022Configuring MyFaces to use Tomahawk
\u2022Three simplest components

\u2013Date input
\u2013Tabbed panes
\u2013Tables with column flow

\u2022Overview of other components
5
J2EE training and tutorials: http://www.coreservlets.com
Using the MyFaces Components
\u2022Put tomahawk.jar in WEB-INF/lib
\u2013Not needed if you use myfaces-all.jar
\u2022Is included in the jsf-blank app at coreservlets.com
\u2013Works in Sun Reference Implementation or any other JSF
implementation
\u2022Import the extended tag library
<%@ taglib uri="http://myfaces.apache.org/extensions"
prefix="t"%>
\u2013Notes
\u2022Older documentation and examples use "x" as the prefix
\u2013"x" for "extensions"
\u2022Current recommendation is to use "t"
\u2013"t" for "tomahawk"
\u2022Bookmark the documentation
\u2013http://myfaces.apache.org/tomahawk/overview.html
6
J2EE training and tutorials: http://www.coreservlets.com
Using the MyFaces Components
(Components that Use JavaScript)
\u2022JavaScript support added in via very
obscure servlet/JSP filter.
\u2013Totally undocumented as of September 1, 2005!
\u2022Need filter and filter-mapping entries
\u2013In web.xml, not faces-config.xml
\u2013The filter-mapping file extension must match the servlet-
mapping file extension
\u2022So, if you change .faces to .jsf, and use extensions, you
need to change the url-pattern entry of both elements!
\u2013In web.xml for servlets 2.4 (e.g., Tomcat 5), order of
elements in web.xml does not matter.
\u2022But in 2.3 version (e.g., Tomcat 4), filter and filter-mapping
must comebefore servlet and servlet-mapping
\u2013These web.xml entries are already present in the "full"
version of jsf-blank
\u2022Download from JSF tutorial at www.coreservlets.com
7
J2EE training and tutorials: http://www.coreservlets.com
Using the MyFaces Components
(Components that Use JavaScript)
\u2022Sample web.xml entries
\u2013Cut and paste from example app or the jsf-blank Web
app: don't enter by hand

<filter>
<filter-name>extensionsFilter</filter-name>
<filter-class>

org.apache.myfaces.component.html.util.ExtensionsFilter
</filter-class>
...

</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>
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...
You must be to leave a comment.
Submit
Characters: ...