webtier@glassfish.java.net

Re: [webtier] JSF as template engine

From: Ed Burns <Ed.Burns_at_Sun.COM>
Date: Fri, 19 Feb 2010 14:38:28 -0800

>>>>> On Wed, 17 Feb 2010 07:30:11 -0800 (PST), webtier_at_javadesktop.org said:

V> We are trying to use JSF as template engine. For example to generate
V> HL7 messages. Let say that we have created the page and we need to
V> get result from rendering of the page in some method without getting
V> through HTTP.

V> What is the best way to do it? It would be perfect for us to use
V> string that contains result of rendering the Page.

The simplest way people have done this in the past is to wrap the
request/response using a Servlet filter placed in front of the
FacesServlet. You're going to have a tough time doing it without at
least starting the process this way because the JSF runtime makes a lot
of assumptions that it's running in a Servlet container via HTTP.

>>>>> On Wed, 17 Feb 2010 13:48:59 -0500, "Lincoln Baxter, III" <lincolnbaxter_at_gmail.com> said:

LB> Otherwise you probably still need to run a JSF server, then use an HTTP
LB> client to send requests in order to capture the output. I agree with Martin
LB> -- look at Apache Velocity or something of that nature.

Yes, exactly.

LB> An extension to JSF could do this? Yes. Has it been done? No. I'm
LB> sure a lot of people would love you if you got something working ;)
LB> Including myself.

I do know that people have made it so JSF renders to PDF. But, again,
this was kicking off the process via the Servlet request/response flow.

V> I will fill out the issue during the next couple days and hopefully
V> with your endorsement it will be implemented in prompt manner :)

At this point, I need to step in and remind people what JCP
specifications are for. They are for providing a vendor neutral
programming model for people to get stuff done with Java.

I've said time and again that JCP specifications are emphatically *not*
the places to invent stuff. We tried that with JSF 1.0 and we're still
trying to live it down. Rather, they should standardize existing,
proven, best practices in a way that maximizes the cohesion of the
entire Java platform. I'm proud of the work we've done with JSF 2.0 in
this regard.

However, I desparately want and need innovation from people like
yourself so that we can ultimately improve the core spec. Let's take
two examples I've been mentoring recently.

1. Metamorfaces. I've been working with a gentleman in Senegal on his
ideas to create a Joomla! like technology built on top of JSF. In fact,
I'm presenting it as part of my keynote at JSFdays <http://jsfdays.com>
next week. You can find out more at <http://metamorfaces.kenai.com>.

2. RooFaces. I've been working with a friend here in Orlando to provide
a Roo add-on that enables Roo to generate JSF2 pages. I mentioned it
recently in a comment on a blog entry at <http://bit.ly/bTFpxg>. This
also happens to be a Kenai project at <http://roofaces.kenai.com>.

LB> And thank you for taking the time to do this. It's the first step to
LB> making change in JEE :) People (like you) who are willing to invest
LB> your time and effort are the reason why JSF and JEE are getting
LB> better every day!

Exactly! I believe in the open source credo that "Innovation Happens
Elsewhere" as described in this excellent online book from Sun
luminsaries Ron Goldman and Richard P. Gabriel
<http://www.dreamsongs.com/IHE/>.

V> 1) Create strategic ideas box
V> 2) Accept ideas during one month
V> 3) Vote for ideas using dukes
V> 4) Implement three the most popular ideas by JSF team
V> 5) Start ideas iteration again after implementation finished

This is a great idea, particularly now that the JSF spec is lead by a
company with more resources they could devote to JSF than Sun.

Ed Burns JSF Spec co-lead
Oracle America, Inc.

-- 
| ed.burns_at_sun.com  | office: 408 884 9519 OR x31640
| homepage:         | http://ridingthecrest.com/