java.net: Wiki

The Source for Java Technology Collaboration


 <<O>>  Difference Topic FaceletsFAQ (28 - 21 Jul 2009 - Main.froethen)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 272 to 272
 All tag libraries written before Facelets came into existence, were written for and using JSP technology. Which means that unless you have a Facelets implementation of the same tag, the tag won't work. Newer tag libraries often ship with a Facelets implementation too, so contact the maintainer of your tag library, and ask for it. Or write it yourself!
Added:
>
>

Why do JSTL tags not work properly?

Make sure you're using the right namespace. Facelets expects the namespace of its subset of JSTL to be http://java.sun.com/jstl/core and not http://java.sun.com/jsp/jstl/core as defined by JSTL 1.1.
 
<-- Please do not ask questions here.  Ask questions on the facelets user mailing list. -->
\ No newline at end of file

 <<O>>  Difference Topic FaceletsFAQ (27 - 27 Jun 2008 - Main.rajeshja)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 267 to 267
  This ensures that markup above and below the composition-related tag isn't trimmed.
Added:
>
>

Why can't I use {JSP Tag library name here} with Facelets?

Facelets is a completely different View technology than JSP. Facelets don't use the Servlet heirarchy for rendering the view. A Facelet doesn't get compiled into a JspServlet?.

All tag libraries written before Facelets came into existence, were written for and using JSP technology. Which means that unless you have a Facelets implementation of the same tag, the tag won't work. Newer tag libraries often ship with a Facelets implementation too, so contact the maintainer of your tag library, and ask for it. Or write it yourself!

 

<-- Please do not ask questions here.  Ask questions on the facelets user mailing list. -->
\ No newline at end of file

 <<O>>  Difference Topic FaceletsFAQ (26 - 09 Apr 2008 - Main.kito75)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 252 to 252
 See above
Added:
>
>

How do I use the JSF 1.2 beforePhase or afterPhase attributesinside of Facelets compositions?

Two things. Fist, in Facelets 1.14 or earlier, the attribute "beforePhase" is misnamed "beforePhaseListener" (same goes for afterPhase). This issue [[http://facelets.dev.java.net/issues/show_bug.cgi?id=294] [294]].

Second, make sure you use this tag with or instead of or :

<f:view beforePhaseListener="#{myBean.myPhaseListenerMethod}">
    <ui:decorate template="/WEB-INF/templates/template.xhtml">
        ....
    </ui:decorate>
</f:view>
This ensures that markup above and below the composition-related tag isn't trimmed.

 
<-- Please do not ask questions here.  Ask questions on the facelets user mailing list. -->
\ No newline at end of file

 <<O>>  Difference Topic FaceletsFAQ (25 - 14 Mar 2008 - Main.jdlee)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 122 to 122
 
Changed:
<
<

Facelets 1.1.11 comes with RI's for both Sun (JSF 1.2) and MyFaces (JSF 1.1) so which one am I running?

>
>

Facelets 1.1.11 comes with jars for both Mojarra (JSF RI 1.2) and MyFaces (JSF 1.1) so which one am I running?

 The classloader determines which version you are running. The best decision is to remove the files from the version you do not need.

To use the Sun JSF 1.2 RI, simply remove the WEB-INF/lib files myfaces-api-1.1.3-SNAPSHOT.jar and myfaces-impl-1.1.3-SNAPSHOT.jar.

Changed:
<
<
To use the MyFaces JSF 1.1 RI (MyFaces version 1.1.3 in Facelets 1.1.11) you must remove the WEB-INF/lib files jsf-api.jar and jsf-impl.jar and then download the Apache Jakarta Commons Codec (version 1.3 works) jar file and put it into WEB-INF/lib. The Codec is required by MyFaces to perform (URL) Base64 encoding and decoding. To download the "Commons Codec" see http://jakarta.apache.org/commons/codec. These (Myfaces) changes have been used to make Facelets v1.1.11 run under Tomcat 5.5.16 with MyFaces release 1.1.3
>
>
To use the MyFaces JSF 1.1 (MyFaces version 1.1.3 in Facelets 1.1.11) you must remove the WEB-INF/lib files jsf-api.jar and jsf-impl.jar and then download the Apache Jakarta Commons Codec (version 1.3 works) jar file and put it into WEB-INF/lib. The Codec is required by MyFaces to perform (URL) Base64 encoding and decoding. To download the "Commons Codec" see http://jakarta.apache.org/commons/codec. These (Myfaces) changes have been used to make Facelets v1.1.11 run under Tomcat 5.5.16 with MyFaces release 1.1.3
 

What does "Re: SEVERE: Error listenerStart " mean?

If your log file shows this error:

 <<O>>  Difference Topic FaceletsFAQ (24 - 08 Jun 2007 - Main.rogerkeays)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 169 to 169
 Render-time tags (UIComponents):
  • all UIComponent tags (e.g. ui:repeat, h:inputText, t:saveState)
Changed:
<
<
See also http://www.ninthavenue.com.au/blog/c:foreach-vs-ui:include-in-facelets
>
>
See also http://www.ninthavenue.com.au/blog/c:foreach-vs-ui:repeat-in-facelets
 

Is Facelets in ibiblio or another Maven repository?


 <<O>>  Difference Topic FaceletsFAQ (23 - 07 Jun 2007 - Main.rogerkeays)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 169 to 169
 Render-time tags (UIComponents):
  • all UIComponent tags (e.g. ui:repeat, h:inputText, t:saveState)
Added:
>
>
See also http://www.ninthavenue.com.au/blog/c:foreach-vs-ui:include-in-facelets
 

Is Facelets in ibiblio or another Maven repository?


 <<O>>  Difference Topic FaceletsFAQ (22 - 04 May 2007 - Main.mcnga1)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 25 to 25
 duplicates component tags) and ui:repeat is similar to the MyFaces Tomahawk t:dataList component as a render-time loop (happens once per request and components inside the list exist only once -- flyweight pattern). Generally, you want to
Changed:
<
<
use a render-time loop, not a compile-time loop.
>
>
use a render-time loop, not a compile-time loop. The only time you want to use c:forEach or c:if logic is when you want to do something you can't do with a render-time loop, such as dynamically adjusting the number of columns in a dataTable.

The technical differences can be fairly dramatic. Lets say you are iterating over 5,000 items in a list, with c:forEach, you'll end up with 5,000 * the number of child components. This could mean your tree now has 15,000 components in a generation, each with it's own set of state. With ui:repeat, h:dataTable, t:dataList, etc-- these 5,000 items are only represented at the time of rendering, leaving you with a single set of children. Basically, your outputText or input instances are just re-evaluated 5,000 times. StateSaving? wise, they are also more efficient since between each iteration, it only saves values for those components which are inputs. If you are simply outputting data (no inputs), your StateSize? shouldn't group by N times.

 

What's the difference between using h:outputText v. just the EL, e.g. #{foo) ?

It's a matter of preference, but Facelets takes all of the stuff between your JSF components, including HTML tags and inlined EL and compiles them as transient components. So they don't add anything to the view state overhead, but they are able to properly participate in the component model for rendering.
Line: 91 to 93
 

How do I use Facelets and JSP in the same application?

Changed:
<
<
You have to use prefix mapping in order for this to work. You can leave the DEFAULT_VIEW_SUFFIX with the JSF defaults, but you must configure Facelet's VIEW_MAPPINGS parameter:
>
>
You have to use prefix mapping for the Facelets pages in order for this to work. Leave the DEFAULT_SUFFIX with the JSF default of .jsp. Configure the Facelet's VIEW_MAPPINGS parameter:
 
<web-app>
Line: 99 to 101
  <param-name>javax.faces.DEFAULT_SUFFIX</param-name> <param-value>.jsp</param-value> </context-param>
Added:
>
>
<-- Facelets pages will use the .xhtml extension -->
  <context-param> <param-name>facelets.VIEW_MAPPINGS</param-name> <param-value>*.xhtml</param-value>
Line: 107 to 112
  <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
Added:
>
>
<-- Use prefix mapping for Facelets pages, e.g. http://localhost:8080/webapp/faces/mypage.xhtml -->
  <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>/faces/*</url-pattern>

 <<O>>  Difference Topic FaceletsFAQ (21 - 01 Dec 2006 - Main.jhook)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 78 to 78
 }
Added:
>
>

I'm getting Duplicate ID Errors (and Bindings)

This can be caused by a couple things. The first is when you use JSTL or logical predicates in your templates which add or remove components based on some volatile logic in your model. It's not so much the case that your component tree can't change between requests, but you do open opportunities for errors to occur. Sometimes explicitly providing id's to your components corrects this problem such that JSF has no way of accidentally assigning a duplicate.

The second way this can happen is when you using 'binding' attributes on your components. If you are binding components to anything other than request-scope, you can run into problems where components, and their assigned identifiers, get injected into another page, conflicting with their identifiers. Again, you can attempt to provide explicit id's to your components to avoid conflict and guarantee uniqueness, but it doesn't fix the greater issue with application/session scoped bindings:

1) UIComponents are not Serializable-- and therefore cannot be clustered

2) UIComponents are not thread safe can cannot be used by multiple requests at once

Binding UIComponents to backing beans is actually something worth doing to ease particular use cases. Instead of using a session/application scoped bean, use a request-scoped composite mediator that receives your session beans and the UIComponent instance to coordinate behavior. The injection of your session-scoped beans can be managed with the faces-config managed-property or with any of the 3rd party extensions such as Spring 2.0 or Seam.

 

How do I use Facelets and JSP in the same application?

You have to use prefix mapping in order for this to work. You can leave the DEFAULT_VIEW_SUFFIX with the JSF defaults, but you must configure Facelet's VIEW_MAPPINGS parameter:

 <<O>>  Difference Topic FaceletsFAQ (20 - 01 Nov 2006 - Main.falcopaul)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 212 to 212
  ...
Added:
>
>

I'm getting a java.lang.IllegalStateException, instead of the Facelets debug screen

You get this exception because some error occurred, and Facelets tries to render the debug screen, but a part of the rendered output were already send to the client. This happens if the Facelets response writer fills up and is thus flushed and send to the client BEFORE the debug output method was invoked.

When part of the rendered output is send to the client, the isCommitted() method of HttpServletResponse will return true and it will not be possible to call HttpServletResonse methods such as reset() or sendRedirect(). These methods are called during generation of the Facelets debug screen.

A response writer will fill up if your (x)html output is larger than the "default" response buffer size, which is may easily be to small. The solution is to increase the web context parameter facelets.BUFFER_SIZE to a sufficiently large value. See the documentation for more information on this parameter.

I'm getting a java.lang.IllegalStateException, instead of my (web.xml) error page

See above

 
<-- Please do not ask questions here.  Ask questions on the facelets user mailing list. -->

 <<O>>  Difference Topic FaceletsFAQ (19 - 18 Oct 2006 - Main.rogerkeays)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 207 to 207
 Use the two jar-files from facelets-1.0.1.
Added:
>
>

How do I change the response contentType?

<f:view contentType="application/rss+xml"> ... </f:view>
 
<-- Please do not ask questions here.  Ask questions on the facelets user mailing list. -->

 <<O>>  Difference Topic FaceletsFAQ (18 - 19 Sep 2006 - Main.mkienenb)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 128 to 128
 

How do I insert a non-breaking space?

use &#160;
Added:
>
>
Alternately, use <f:verbatim>&amp;nbsp;</f:verbatim>
 

How do I prevent HTML comments from being rendered?

Add the following to your web.xml:

 <<O>>  Difference Topic FaceletsFAQ (17 - 14 Sep 2006 - Main.enchos)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 181 to 181
 Another is to pass the bean as a ValueBinding and pass the method as a ValueBinding (example needed here).
Added:
>
>
Rick Hightower has an example in his article on Facelets. His template uses this code to render a commandLink:

<h:commandLink id="#{action}" value="#{label}" 
                                     action="#{backingBean[action]}"/>

And he calls the template like this:

<a:columnCommand label="Edit" action="editCD" 
backingBean="${CDManagerBean}"/>
 There is also an article that discusses using a custom ComponentHandler to pass method bindings.

http://andrewfacelets.blogspot.com/2006/06/creating-composite-controls-with-jsf.html

Line: 188 to 203
 

The el-jars from the newest facelets-distro require java 5. Where do I find el-jars that work with JDK 1.4?

Changed:
<
<
Use the two jar-files from facelets-1.1.8.
>
>
Use the two jar-files from facelets-1.0.1.
 

<-- Please do not ask questions here.  Ask questions on the facelets user mailing list. -->

 <<O>>  Difference Topic FaceletsFAQ (16 - 07 Sep 2006 - Main.ajesse)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 186 to 186
 http://andrewfacelets.blogspot.com/2006/06/creating-composite-controls-with-jsf.html
Added:
>
>

The el-jars from the newest facelets-distro require java 5. Where do I find el-jars that work with JDK 1.4?

Use the two jar-files from facelets-1.1.8.

 
<-- Please do not ask questions here.  Ask questions on the facelets user mailing list. -->

 <<O>>  Difference Topic FaceletsFAQ (15 - 29 Aug 2006 - Main.brondsem)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 6 to 6
 
<-- Please do not ask questions here.  Ask questions on the facelets user mailing list. -->

Does Facelets support JSR-168 portlets?

Changed:
<
<
Yes, since JSF in general does. Certain components (e.g. some that use javascript) might not. You should put <ui:composition> around your content so that your portlet doesn't generate html/body tags. I think there are other options for this, too, like defining all your xml namespaces on a <h:form> instead of <html>... but I can't remember the specifics.
>
>
Yes, since JSF in general does. Certain components (e.g. some that use javascript) might not. You should put <ui:composition> around your content so that your portlet doesn't generate html/body tags. Also, I think you can define your xml namespaces on any root element, so you can skip html/head and just use <f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"> ...
 

How can I use ADF and Facelets together?

You need to install the FaceletViewHandler using:

 <<O>>  Difference Topic FaceletsFAQ (14 - 17 Aug 2006 - Main.mkienenb)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Changed:
<
<

Unanswered questions

  • How do you use i18n with Facelets?
>
>
<-- Please do not ask questions here.  Ask questions on the facelets user mailing list. -->
 

Does Facelets support JSR-168 portlets?

Yes, since JSF in general does. Certain components (e.g. some that use javascript) might not. You should put <ui:composition> around your content so that your portlet doesn't generate html/body tags. I think there are other options for this, too, like defining all your xml namespaces on a <h:form> instead of <html>... but I can't remember the specifics.

How can I use ADF and Facelets together?

Changed:
<
<
You need to install the FaceletViewHandler? using:
>
>
You need to install the FaceletViewHandler using:
 
 <context-param>
Line: 30 to 30
 

What's the difference between using h:outputText v. just the EL, e.g. #{foo) ?

It's a matter of preference, but Facelets takes all of the stuff between your JSF components, including HTML tags and inlined EL and compiles them as transient components. So they don't add anything to the view state overhead, but they are able to properly participate in the component model for rendering.
Changed:
<
<
(Posted by Craig McClanahan?)
>
>
(Posted by Craig McClanahan)
 Actually, there is one important difference. By default, the h:outputText component escapes dangerous characters in HTML, such as a left angle bracket ('<'), while using a plain EL expression does not. Without escaping (or ensuring that such characters do not exist in your model data), your application might be vulnerable to cross site scripting attacks.

Why are my attributes not set in my component ?

Line: 54 to 54
 }
Changed:
<
<
In JSF 1.2, ValueBinding? becomes ValueExpression? and the getter changes a bit
>
>
In JSF 1.2, ValueBinding becomes ValueExpression and the getter changes a bit
 
private String foo = null;
public String getFoo() {
Line: 103 to 103
 
Changed:
<
<

Facelets 1.1.11 comes with RI's for both Sun (JSF 1.2) and MyFaces? (JSF 1.1) so which one am I running?

>
>

Facelets 1.1.11 comes with RI's for both Sun (JSF 1.2) and MyFaces (JSF 1.1) so which one am I running?

 The classloader determines which version you are running. The best decision is to remove the files from the version you do not need.

To use the Sun JSF 1.2 RI, simply remove the WEB-INF/lib files myfaces-api-1.1.3-SNAPSHOT.jar and myfaces-impl-1.1.3-SNAPSHOT.jar.

Changed:
<
<
To use the MyFaces? JSF 1.1 RI (MyFaces? version 1.1.3 in Facelets 1.1.11) you must remove the WEB-INF/lib files jsf-api.jar and jsf-impl.jar and then download the Apache Jakarta Commons Codec (version 1.3 works) jar file and put it into WEB-INF/lib. The Codec is required by MyFaces? to perform (URL) Base64 encoding and decoding. To download the "Commons Codec" see http://jakarta.apache.org/commons/codec. These (Myfaces) changes have been used to make Facelets v1.1.11 run under Tomcat 5.5.16 with MyFaces? release 1.1.3
>
>
To use the MyFaces JSF 1.1 RI (MyFaces version 1.1.3 in Facelets 1.1.11) you must remove the WEB-INF/lib files jsf-api.jar and jsf-impl.jar and then download the Apache Jakarta Commons Codec (version 1.3 works) jar file and put it into WEB-INF/lib. The Codec is required by MyFaces to perform (URL) Base64 encoding and decoding. To download the "Commons Codec" see http://jakarta.apache.org/commons/codec. These (Myfaces) changes have been used to make Facelets v1.1.11 run under Tomcat 5.5.16 with MyFaces release 1.1.3
 

What does "Re: SEVERE: Error listenerStart " mean?

If your log file shows this error:
Line: 151 to 151
 

Is Facelets in ibiblio or another Maven repository?

Changed:
<
<
It's in the java.net Maven repository:

https://maven-repository.dev.java.net/repository/

>
>
Yes it is now in the ibiblio repository.
 groupId : com.sun.facelets
Added:
>
>
 artifactId: jsf-facelets
Added:
>
>
It is also in the java.net Maven repository: https://maven-repository.dev.java.net/repository/
 In the pom:
<repositories>
Line: 171 to 173
 
Added:
>
>

Can I pass a MethodBinding to a template?

No, you can only pass a value binding to a template.

One workaround is to pass the bean as a ValueBinding and hardcode the method name in your template (example needed here).

Another is to pass the bean as a ValueBinding and pass the method as a ValueBinding (example needed here).

There is also an article that discusses using a custom ComponentHandler to pass method bindings.

http://andrewfacelets.blogspot.com/2006/06/creating-composite-controls-with-jsf.html

<-- Please do not ask questions here.  Ask questions on the facelets user mailing list. -->

 <<O>>  Difference Topic FaceletsFAQ (13 - 26 Jul 2006 - Main.kito75)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 118 to 118
 Then it indicates you are using the Sun RI v1.2 or higher on a container or application server which does not support the Servlet Spec v2.5 or above. An example is Tomcat 5.5 which only supports Servlet v2.4.
Added:
>
>

Why doesn't my &bull; / &Aring; / &amp; render in the output?

Facelets 1.1.11 does escaping properly (earlier versions are broken), but only supports the character entities built into XML: &amp; &lt; &gt; &apos; &quot;

You must use the numeric entities for &bull; &Aring;, etc.

 

How do I insert a non-breaking space?

use &#160;
Line: 141 to 148
 Render-time tags (UIComponents):
  • all UIComponent tags (e.g. ui:repeat, h:inputText, t:saveState)
Added:
>
>

Is Facelets in ibiblio or another Maven repository?

It's in the java.net Maven repository:

https://maven-repository.dev.java.net/repository/

groupId : com.sun.facelets artifactId: jsf-facelets

In the pom:

<repositories>
              <repository>
                        <id>dev.java.net</id>
                        <name>dev.java.net-repo </name>
                        <url>https://maven-repository.dev.java.net/repository/</url>
                        <layout>legacy</layout> 
                </repository>

</repositories>

 <<O>>  Difference Topic FaceletsFAQ (12 - 11 Jul 2006 - Main.rogerkeays)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Changed:
<
<
>
>
 

Unanswered questions

  • How do you use i18n with Facelets?
Changed:
<
<

Does Facelets support JSR-168 portlets?

Answer

>
>

Does Facelets support JSR-168 portlets?

 Yes, since JSF in general does. Certain components (e.g. some that use javascript) might not. You should put <ui:composition> around your content so that your portlet doesn't generate html/body tags. I think there are other options for this, too, like defining all your xml namespaces on a <h:form> instead of <html>... but I can't remember the specifics.
Changed:
<
<

How can I use ADF and Facelets together?

Answer

>
>

How can I use ADF and Facelets together?

 You need to install the FaceletViewHandler? using:
Line: 24 to 20
 in WEB-INF/web.xml, not in faces-config.xml.
Changed:
<
<

What's the difference between c:forEach and ui:repeat?

Answer

>
>

What's the difference between c:forEach and ui:repeat?

 c:forEach is a "compile-time" loop (happens once per page, and duplicates component tags) and ui:repeat is similar to the MyFaces Tomahawk t:dataList component as a render-time loop (happens once per request and components inside the list exist only once -- flyweight pattern). Generally, you want to use a render-time loop, not a compile-time loop.
Changed:
<
<

What's the difference between using h:outputText v. just the EL, e.g. #{foo) ?

Answer

>
>

What's the difference between using h:outputText v. just the EL, e.g. #{foo) ?

 It's a matter of preference, but Facelets takes all of the stuff between your JSF components, including HTML tags and inlined EL and compiles them as transient components. So they don't add anything to the view state overhead, but they are able to properly participate in the component model for rendering.

(Posted by Craig McClanahan?) Actually, there is one important difference. By default, the h:outputText component escapes dangerous characters in HTML, such as a left angle bracket ('<'), while using a plain EL expression does not. Without escaping (or ensuring that such characters do not exist in your model data), your application might be vulnerable to cross site scripting attacks.

Changed:
<
<

Why are my attributes not set in my component ?

Answer

>
>

Why are my attributes not set in my component ?

 (Composed by Tom Baeyens based on https://facelets.dev.java.net/servlets/BrowseList?list=users&by=thread&from=386702 )

The basics about UIComponents and tags can be found in the facelet docs in section UIComponent: https://facelets.dev.java.net/nonav/docs/dev/docbook.html#taglib-create-component

Line: 89 to 78
 }
Changed:
<
<

How do I use Facelets and JSP in the same application?

Answer

>
>

How do I use Facelets and JSP in the same application?

 You have to use prefix mapping in order for this to work. You can leave the DEFAULT_VIEW_SUFFIX with the JSF defaults, but you must configure Facelet's VIEW_MAPPINGS parameter:
Line: 116 to 103
 
Changed:
<
<

Facelets 1.1.11 comes with RI's for both Sun (JSF 1.2) and MyFaces? (JSF 1.1) so which one am I running?

Answer

>
>

Facelets 1.1.11 comes with RI's for both Sun (JSF 1.2) and MyFaces? (JSF 1.1) so which one am I running?

 The classloader determines which version you are running. The best decision is to remove the files from the version you do not need.

To use the Sun JSF 1.2 RI, simply remove the WEB-INF/lib files myfaces-api-1.1.3-SNAPSHOT.jar and myfaces-impl-1.1.3-SNAPSHOT.jar.

To use the MyFaces? JSF 1.1 RI (MyFaces? version 1.1.3 in Facelets 1.1.11) you must remove the WEB-INF/lib files jsf-api.jar and jsf-impl.jar and then download the Apache Jakarta Commons Codec (version 1.3 works) jar file and put it into WEB-INF/lib. The Codec is required by MyFaces? to perform (URL) Base64 encoding and decoding. To download the "Commons Codec" see http://jakarta.apache.org/commons/codec. These (Myfaces) changes have been used to make Facelets v1.1.11 run under Tomcat 5.5.16 with MyFaces? release 1.1.3

Changed:
<
<

What does "Re: SEVERE: Error listenerStart " mean?

Answer

>
>

What does "Re: SEVERE: Error listenerStart " mean?

 If your log file shows this error:

> SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.GlassFishConfigureListener

Line: 135 to 118
 Then it indicates you are using the Sun RI v1.2 or higher on a container or application server which does not support the Servlet Spec v2.5 or above. An example is Tomcat 5.5 which only supports Servlet v2.4.
Added:
>
>

How do I insert a non-breaking space?

use &#160;

How do I prevent HTML comments from being rendered?

Add the following to your web.xml:
  <context-param>
    <param-name>facelets.SKIP_COMMENTS</param-name>
    <param-value>true</param-value>
  </context-param>

Why doesn't my c:if / ui:repeat / ui:include work properly?

You're probably using a bad combination of build-time and render-time tags. For example, c:if is a build-time tag, so any EL expressions are only evaluated once (when the tree is built), even if you put it inside a ui:repeat or h:dataTable. Conversly, since ui:repeat is a 'render-time tag' (i.e. a UIComponent), you can't use it to iterate over build-time tags such as f:selectItem.

Build-time (facelet) tags:

  • all JSTL tags (e.g. c:if, c:forEach, c:choose)
  • all ui tags except ui:repeat (e.g. ui:include, ui:decorate, ui:composition)
  • all core faces tags except f:verbatim (e.g. f:validator, f:convertNumber, f:selectItem)

Render-time tags (UIComponents):

  • all UIComponent tags (e.g. ui:repeat, h:inputText, t:saveState)

 <<O>>  Difference Topic FaceletsFAQ (11 - 05 Jul 2006 - Main.humble)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 115 to 115
 </web-app>
Added:
>
>

Facelets 1.1.11 comes with RI's for both Sun (JSF 1.2) and MyFaces? (JSF 1.1) so which one am I running?

Answer

The classloader determines which version you are running. The best decision is to remove the files from the version you do not need.

To use the Sun JSF 1.2 RI, simply remove the WEB-INF/lib files myfaces-api-1.1.3-SNAPSHOT.jar and myfaces-impl-1.1.3-SNAPSHOT.jar.

To use the MyFaces? JSF 1.1 RI (MyFaces? version 1.1.3 in Facelets 1.1.11) you must remove the WEB-INF/lib files jsf-api.jar and jsf-impl.jar and then download the Apache Jakarta Commons Codec (version 1.3 works) jar file and put it into WEB-INF/lib. The Codec is required by MyFaces? to perform (URL) Base64 encoding and decoding. To download the "Commons Codec" see http://jakarta.apache.org/commons/codec. These (Myfaces) changes have been used to make Facelets v1.1.11 run under Tomcat 5.5.16 with MyFaces? release 1.1.3

What does "Re: SEVERE: Error listenerStart " mean?

Answer

If your log file shows this error:

> SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.GlassFishConfigureListener
> java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;

Then it indicates you are using the Sun RI v1.2 or higher on a container or application server which does not support the Servlet Spec v2.5 or above. An example is Tomcat 5.5 which only supports Servlet v2.4.


 <<O>>  Difference Topic FaceletsFAQ (10 - 29 Jun 2006 - Main.jbigfoot)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 55 to 55
 
private String foo = null;
public String getFoo() {
Changed:
<
<
if (this.foo = null) return this.label;
>
>
if (this.foo = null) return this.foo;
  ValueBinding? vb = this.getValueBinding("foo"); if (vb = null) return (String) vb.getValue(faces); return null;
Line: 69 to 69
 
private String foo = null;
public String getFoo() {
Changed:
<
<
if (this.foo = null) return this.label;
>
>
if (this.foo = null) return this.foo;
  ValueExpression? ve = this.getValueExpression("foo"); if (ve = null) return (String) ve.getValue(faces.getELContext()); return null;

 <<O>>  Difference Topic FaceletsFAQ (9 - 25 Jun 2006 - Main.kito75)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 89 to 89
 }
Added:
>
>

How do I use Facelets and JSP in the same application?

Answer

You have to use prefix mapping in order for this to work. You can leave the DEFAULT_VIEW_SUFFIX with the JSF defaults, but you must configure Facelet's VIEW_MAPPINGS parameter:

<web-app>
  <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.jsp</param-value>
  </context-param>
  <context-param>
    <param-name>facelets.VIEW_MAPPINGS</param-name>
    <param-value>*.xhtml</param-value>
  </context-param>     
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
   </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>
</web-app>

 <<O>>  Difference Topic FaceletsFAQ (8 - 21 Apr 2006 - Main.brondsem)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home

Unanswered questions

  • How do you use i18n with Facelets?
Changed:
<
<
  • Does Facelets support JSR-168 porlets?
>
>

Does Facelets support JSR-168 portlets?

Answer

Yes, since JSF in general does. Certain components (e.g. some that use javascript) might not. You should put <ui:composition> around your content so that your portlet doesn't generate html/body tags. I think there are other options for this, too, like defining all your xml namespaces on a <h:form> instead of <html>... but I can't remember the specifics.
 

How can I use ADF and Facelets together?


 <<O>>  Difference Topic FaceletsFAQ (7 - 21 Apr 2006 - Main.mkienenb)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 21 to 21
 in WEB-INF/web.xml, not in faces-config.xml.
Added:
>
>

What's the difference between c:forEach and ui:repeat?

Answer

c:forEach is a "compile-time" loop (happens once per page, and duplicates component tags) and ui:repeat is similar to the MyFaces Tomahawk t:dataList component as a render-time loop (happens once per request and components inside the list exist only once -- flyweight pattern). Generally, you want to use a render-time loop, not a compile-time loop.
 

What's the difference between using h:outputText v. just the EL, e.g. #{foo) ?

Answer


 <<O>>  Difference Topic FaceletsFAQ (6 - 30 Mar 2006 - Main.arash)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Added:
>
>

Unanswered questions

  • How do you use i18n with Facelets?
  • Does Facelets support JSR-168 porlets?
 

How can I use ADF and Facelets together?

Answer

Line: 25 to 29
 (Posted by Craig McClanahan?) Actually, there is one important difference. By default, the h:outputText component escapes dangerous characters in HTML, such as a left angle bracket ('<'), while using a plain EL expression does not. Without escaping (or ensuring that such characters do not exist in your model data), your application might be vulnerable to cross site scripting attacks.
Deleted:
<
<

Unanswered questions

How do you use i18n with Facelets?
 

Why are my attributes not set in my component ?

Answer


 <<O>>  Difference Topic FaceletsFAQ (5 - 22 Mar 2006 - Main.tombaeyens)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 27 to 27
 

Unanswered questions

Added:
>
>
How do you use i18n with Facelets?
 
Changed:
<
<
--++ How do you use i18n with Facelets?
>
>

Why are my attributes not set in my component ?

 

Answer

Added:
>
>
(Composed by Tom Baeyens based on https://facelets.dev.java.net/servlets/BrowseList?list=users&by=thread&from=386702 )

The basics about UIComponents and tags can be found in the facelet docs in section UIComponent: https://facelets.dev.java.net/nonav/docs/dev/docbook.html#taglib-create-component

There are different ways in obtaining the tag attribute value in your component. But a plain getter-setter property implementation won't do it.

In JSF 1.1, you have to implement your property foo like this

private String foo = null;
public String getFoo() {
  if (this.foo != null) return this.label;
  ValueBinding vb = this.getValueBinding("foo");
  if (vb != null) return (String) vb.getValue(faces);
  return null;
}
public void setFoo(String foo) {
  this.foo = foo;
}

In JSF 1.2, ValueBinding? becomes ValueExpression? and the getter changes a bit

private String foo = null;
public String getFoo() {
  if (this.foo != null) return this.label;
  ValueExpression ve = this.getValueExpression("foo");
  if (ve != null) return (String) ve.getValue(faces.getELContext());
  return null;
}
public void setFoo(String foo) {
  this.foo = foo;
}

alternatives are using getAttributes() within your renderer or overriding the setValueBinding in your component like this

public void setValueBinding(String name, ValueBinding valueBinding) {
  if ("foo".equals(name)) {
    this.foo = valueBinding.get(getFacesContext());
  }
}
 

 <<O>>  Difference Topic FaceletsFAQ (4 - 21 Mar 2006 - Main.mkienenb)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Changed:
<
<

How do you use i18n with Facelets?

>
>

How can I use ADF and Facelets together?

 

Answer

Added:
>
>
You need to install the FaceletViewHandler? using:
 
Added:
>
>
 <context-param>
   <param-name>oracle.adf.view.faces.ALTERNATE_VIEW_HANDLER</param-name>
   <param-value>com.sun.facelets.FaceletViewHandler</param-value>
 </context-param>
 
Added:
>
>
in WEB-INF/web.xml, not in faces-config.xml.
 
Changed:
<
<

What's the difference between using h:outputText v. just the EL, e.g. #{foo) ?

>
>

What's the difference between using h:outputText v. just the EL, e.g. #{foo) ?

 

Answer

It's a matter of preference, but Facelets takes all of the stuff between your JSF components, including HTML tags and inlined EL and compiles them as transient components. So they don't add anything to the view state overhead, but they are able to properly participate in the component model for rendering.
Line: 16 to 25
 (Posted by Craig McClanahan?) Actually, there is one important difference. By default, the h:outputText component escapes dangerous characters in HTML, such as a left angle bracket ('<'), while using a plain EL expression does not. Without escaping (or ensuring that such characters do not exist in your model data), your application might be vulnerable to cross site scripting attacks.
Added:
>
>

Unanswered questions

--++ How do you use i18n with Facelets?

Answer


 <<O>>  Difference Topic FaceletsFAQ (3 - 13 Feb 2006 - Main.rupeal)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Added:
>
>

How do you use i18n with Facelets?

Answer

 

What's the difference between using h:outputText v. just the EL, e.g. #{foo) ?


 <<O>>  Difference Topic FaceletsFAQ (2 - 24 Sep 2005 - Main.craig_mcc)
Line: 1 to 1
 
META TOPICPARENT name="Facelets"
Facelets Wiki Home
Line: 8 to 8
 

Answer

It's a matter of preference, but Facelets takes all of the stuff between your JSF components, including HTML tags and inlined EL and compiles them as transient components. So they don't add anything to the view state overhead, but they are able to properly participate in the component model for rendering.
Added:
>
>
(Posted by Craig McClanahan?) Actually, there is one important difference. By default, the h:outputText component escapes dangerous characters in HTML, such as a left angle bracket ('<'), while using a plain EL expression does not. Without escaping (or ensuring that such characters do not exist in your model data), your application might be vulnerable to cross site scripting attacks.

 <<O>>  Difference Topic FaceletsFAQ (1 - 19 Sep 2005 - Main.brondsem)
Line: 1 to 1
Added:
>
>
META TOPICPARENT name="Facelets"
Facelets Wiki Home

What's the difference between using h:outputText v. just the EL, e.g. #{foo) ?

Answer

It's a matter of preference, but Facelets takes all of the stuff between your JSF components, including HTML tags and inlined EL and compiles them as transient components. So they don't add anything to the view state overhead, but they are able to properly participate in the component model for rendering.

Topic FaceletsFAQ . { View | Diffs r28 < r27 < r26 < r25 | More }
 XML java.net RSS