dev@jsftemplating.java.net

Re: JSFTemplating: location of UIComponentFactory annotations + couple other questions

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Fri, 04 Jan 2008 11:40:28 -0800

Hi Rogers,

See my comments below...

Rogers Reilly wrote:
> Hi,
>
> I'm evaluating JSFTemplating for a project, and had a couple quick
> questions.
>
> First, very simply, I can't seem to find the class
> com.sun.jsftemplating.annotation.UIComponentFactory, which is
> referenced in one of the tutorial articles. All I'm trying to do is
> get a simple custom component to render using a template file, which
> as I understand it, should just require the Component java class, a
> template file, a faces-config entry, and an annotated
> UIComponentFactory class--the last of which I can't pull off without
> finding com.sun.jsftemplating.annotation.UIComponentFactory. I've
> downloaded a bunch of wars and versions of jsftemplating.jar, but none
> seem to have this class.
This file should be available in jsftemplating-dt.jar. If you add that
to your build classpath you should find it. FYI, this is only needed
during the build, you won't need it at runtime. This includes the
annotation processors for "apt" so it will do necessary configuration
for you.
> Second, is it generally possible to use JSF Templating as a "drop-in"
> solution for custom component rendering? I have messed around with
> FreeMarker templates for doing this in the past, but would love to use
> this JSF-centric approach if possible. I am sticking with Facelets
> for my overall page composition solution.
Short answer: yes, it should be.

If you would like to continue using Facelets (instead of JSFTemplating's
support for Facelets which isn't 100% complete... i.e. it doesn't
support custom facelet tags, but on the other hand, it does support
jsftemplating events in facelets pages), then I would recommend that you
modify the faces-config.xml file in the jsftemplating.jar file to not
specify the JSFTemplating ViewHandler. This will prevent JSFTemplating
for doing anything to your pages (but components created using JSFT will
still work fine).
> Third, is Dynafaces (the modified version) required to use JSF
> Templating in the above capacity?
No, not for components. Only for pages... again, remove the ViewHandler
from the faces-config.xml file to drop this dependency.
> ICEFaces is my component suite (with RI 1.2), and I've had problems in
> the past making the partial lifecycle in Dynafaces play nice with
> ICEFaces--although a first try with the modified version didn't give
> any errors.
True, it shouldn't b/c it doesn't actually get used unless you use it.
Although, I suspect you'd have to have it in your classpath unless you
remove the ViewHandler from jsftemplating.jar's faces-config.xml file.
> If all I'm doing is using the templating capability and possibly some
> event/handler stuff, it seems like the partial lifecycle stuff
> wouldn't be needed; but I don't know what all is going on under the hood.
If you use the event/handler stuff in any pages (requires you to use a
JSFT page), or you use JSFT to define Facelets pages (instead of the
facelets itself)... then it will likely cause a problem.

Good luck!

Ken Paulsen

> Thanks in advance,
> Rogers