segunda-feira, 17 de setembro de 2007

Dicas JavaServer Faces

retirados de: http://www.oracle.com/webapps/online-help/jdeveloper/10.1.3?topic=sf_ajsfwebxml_html

Part of a JSF application's configuration is determined by the contents of its J2EE application deployment descriptor, WEB-INF/web.xml . JDeveloper automatically creates the web.xml file when you create a JSF page or document, and initializes the JSF configuration to default settings. You can then modify these settings for your particular application.

For more information about the web.xml file, see About Web Module Runtime Configuration. For information about configuring web.xml for ADF Faces, see About Configuring web.xml for ADF Faces.

Three web.xml elements contain JSF-related configuration settings:

  • <context-param> - sets parameters for the JSF application
  • <servlet> - maps the JSF servlet to a symbolic name
  • <servlet-mapping> - maps the JSF servlet symbolic name to a URL pattern
Use to set application-wide JSF parameters. The syntax is:

    parmName
   parmValue        
where
parmName
is the parameter's symbolic name
parmValue
is the value you wish to set for the parameter

The following parameters are available in JSF:

javax.faces.CONFIG_FILES
Use: Specifies paths to JSF application configuration resource files. Value: A comma-separated list of application-context-relative paths.
javax.faces.DEFAULT_SUFFIX
Use: Specifies a file extension (suffix) for JSP pages that contain JSF components. The default is .jsp . Value: A file extension
javax.faces.LIFECYCLE_ID
Use: Selects a lifecycle identifier other than the default set by the javax.faces.lifecycle.LifecycleFactory.DEFAULT_LIFECYCLE constant. Value: Lifecycle identifier
javax.faces.STATE_SAVING_METHOD
Use: Selects a state saving method. Value: Either server or client. The default is server, which stores the application's view state on the server. If you select client, JSF stores the view state on the browser client.
Use: Maps the JSF servlet javax.faces.webapp.FacesServlet to a symbolic name. Value: Symbolic name. For example, to use myServlet as the symbolic name, add the following to web.xml:

 myServlet
 javax.faces.webapp.FacesServlet
        
Use: Maps URL patterns to the JSF servlet's symbolic name. Value: URL pattern. You can use either a path prefix or extension suffix pattern:
path prefix
provides a mapping to the JSF servlet. All URLs in the application would contain this prefix in their path. For example, http://localhost:8080/login/faces/index.jsp

 faces-servlet-name
 /faces/*
              
extension suffix
provides an extension to which the servlet maps JSPs that include JSF content. For example, http://localhost:8080/login/index.faces

 faces-servlet-name 
 *.faces
             

Nenhum comentário: