Jason Lee wrote:
On Mon, Aug 4, 2008 at 6:44 AM, Oliver Wolff <oliver.wolff@oio.de> wrote:
1: Do I have to use xhtml files or can I use other XML-Formats as well?
Currently I'm using jspx (Hack for eclipse: autocomplete with facelets).
I'm not entirely sure what you mean by "XML-Formats" but JSFTemplating
only requires (currently) that the page be valid XML and doesn't care
about file extensions.
JSPX is not currently understood by JSFTemplating. A new
LayoutDefinitionManager would need to be written to understand that XML
format. Besides the Facelets xhtml format, there's a proprietary XML
format supported by JSFTemplating and a non-XML format.
2: How can I make it work at all? Currently I´m trying to use a templated
<ui:compostion> layout but only the <ui:compostion></ui:compostion> part of
the composition.jspx is rendered (literally without processing / replacing)
without the content of the corresponding layout page. Is <ui:compostion>
supported at all?
Make sure you have the facelets namespace definitions at the top of
your XML file. This is what we look for to detect a Facelets page. If
you have it, send an example for us to try.
Yes. In fact, it was one of the first tags to be supported (I use it
a lot, fwiw). My guess is that JSFTemplating isn't recognizing the
file as one it should process, so it delegates to the default
ViewHandler, which doesn't understand, so it's rendered literally.
Could you email a small example of one of your pages? We could then
make sure the template reader is finding what it needs, or make the
reader more robust.
3: What is the correct configuration? I found a side-by-side example
(facelets and jsftemplating)
(http://java.sun.com/developer/technicalArticles/J2EE/jsf_templating/) but I
want to use a single ViewHandler not two: What configuration is needed
therefore? As far as I understand:
faces-config
No <view-handler> needs to be configured, the configuration will be taken
from the jsftemplating.jar
web.xml:
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.jspx</param-value>
</context-param>
<context-param>
<param-name>com.sun.jsftemplating.VIEW_MAPPINGS</param-name>
<param-value>*.jsf</param-value>
</context-param>
<context-param>
<param-name>facelets.LIBRARIES</param-name>
<param-value>
/faceletComponent/faceletCustomTags.xml;
</param-value>
</context-param>
Is there anything more that needs to be configured? Do I need any more Libs
for facelets support?
The DEFAULT_SUFFIX you have above will work as expected for Facelets
files. In other words,
http://localhost:8080/context/foo.jsf will look
for "foo.jspx" in your context root of your application. And the next
param tells JSFT to process it only if the requested file ends in
*.jsf. So I assume you also have a *.jsf Faces Servlet mapping? If
not, nothing will process the request.
Another option is to use a *.jspx Faces Servlet mapping and drop the
DEFAULT_SUFFIX and change/drop the VIEW_MAPPINGS. Then your requets to
*.jspx will be processed by JSFTemplating (i.e.
http://localhost:8080/context/foo.jspx). When you use this approach,
you can also use the welcome-file to specify a JSF welcome page
(web.xml: <welcome-file>hello.jspx</welcome-file>; browser:
http://localhost:8080/context/; loads: context root hello.jspx).
With JSFTemplating, all you typically have to do is drop the jar in
your classpath and you're set (correct me here if I'm wrong, Ken).
There are some context-params that JSFTemplating understands, but I
don't think they're necessary unless you need to override the
defaults.
Container & Libs:
Woodstock 4.3 build 6
JSFTemplating May Stable, current nightly (4th August)
RI 1.2 09
Tomcat 6.016
JDK 6
Eclipse 3.4
Should be fine. Although as a GlassFish developer I am biased toward
GlassFish. ;) T6 shouldn't cause a problem, though.
Good luck!
Ken Paulsen
As far as I know, there should be nothing in that setup that would
break JSFT support, but maybe Ken can chime in when he comes online.
In the meantime, if you can send that small page sample, I'll take a
look at it and the template reader (which I wrote, fwiw).