Notes on MyFaces

This page is a collection of notes on MyFaces. MyFaces is a Jakarta project run under the Apache umbrella to create an maintain a public implementation of the JavaServer Faces specification.

Important Web Pages

JavaServer Faces is specified by JSR-252. The specification is quite detailed and
doesn't give a lot of insight into how to use it. The Sun reference implementation is available at JSF.

MyFaces is an Apache Jakarta project. See http://myfaces.apache.org/.
This from the home page:

What is Java Server Faces (JSF)?

Java Server Faces is a new and upcoming web application framework that accomplishes the MVC paradigm. It is comparable to the well-known Struts Framework but has features and concepts that are beyond those of Struts - especially the component orientation.

Here are some notes on Oracles contributions:

Trinidad (or formal ADF Faces) refers to an open source code donation contributed by Oracle. The actual components are now licensed under the ASF license and can be used by the public. You can download the source for the components form the Apache Incubator SVN here. As the donation works its way through the incubation process and eventually merges with MyFaces.

Trinidad (or formal ADF Faces) comes with very high quality components, a dialog framework, as well as personalization and skinning capabilities. Trinidad features include: file upload support, client-side validation, partial rendering of a page (AJAX-style), data tables, hierarchical tables, color/date pickers, progress indicators, menu tabs/buttons, wizards, internationalization and accessibility. A complete list of the Trinidad components is available (here.) This project starts with more than 100 components which have already been documented and thoroughly tested.

MyFaces has a number of user examples. There is a lot of stuff available at http://www.irian.at/myfaces/home.jsf.
Besides looking at the general structure of these examples, they are not going serve all that well for Sakai purposes, because
Sakai adds additional contraints on how applications are invoked and run. (what these?)

Sakai also has examples of the Sakai Style Guide elements written for MyFaces in the JSF module.

Here's an interesting note from the FAQ:

Does MyFaces work with Tomcat 5.5?

Yes, Apache MyFaces works with Tomcat5.5. If you see a blank page in your browser, try to remove the JAR files jsp-2.0.jar and commons-el.jar of the folder WEB-INF/lib.

There is a wealth of documentation available on the MyFaces wiki site: http://wiki.apache.org/myfaces/.

Configuration Parameters

These are hard to dig out of the documentation. As near as I can tell, the following parameters are extensions to the core JSF specification:

Name

Values

Description

javax.faces.application.CONFIG_FILES or
javax.faces.CONFIG_FILES

comma separated list

Comma separated list of URIs of additional faces config files.
(e.g. /WEB-INF/my-config.xml) Attention: /WEB-INF/faces.config.xml is added automatically.
See JSF 1.0 PRD2, 10.3.2

javax.faces.STATE_SAVING_METHOD

server

 

myfaces_allow_javascript or
org.apache.myfaces.ALLOW_JAVASCRIPT

true or false

This parameter tells MyFaces if javascript code should be allowed in the
rendered HTML output.
If javascript is allowed, command_link anchors will have javascript code
that submits the corresponding form.
If javascript is not allowed, the state saving info and nested parameters
will be added as url parameters.
Default: "true"

org.apache.myfaces.PRETTY_HTML

true or false

If true, rendered HTML code will be formatted, so that it is "human readable".
i.e. additional line separators and whitespace will be written, that do not
influence the HTML code.
Default: "true"

AddResourceClass

???

 

AddResourceClassFromServletContext

???

 

CurrentInstance

true or false

 

org.apache.myfaces.AUTO_SCROLL

true or false

If true, a javascript function will be rendered that is able to restore the
former vertical scroll on every request. Convenient feature if you have pages
with long lists and you do not want the browser page to always jump to the top
if you trigger a link or button action that stays on the same page.
Default: "false"

org.apache.myfaces.DETECT_JAVASCRIPT

true or false

This parameter tells MyFaces if javascript code should be allowed in the
rendered HTML output.
If javascript is allowed, command_link anchors will have javascript code
that submits the corresponding form.
If javascript is not allowed, the state saving info and nested parameters
will be added as url parameters.
Default: "false"
Setting this param to true should be combined with STATE_SAVING_METHOD "server" for
best results.
This is an EXPERIMENTAL feature. You also have to enable the detector filter/filter mapping below to get
JavaScript detection working.