Meaningless Drivel is fun!*
The moose likes JSF and the fly likes JSF2 XML and XSLT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF2 XML and XSLT" Watch "JSF2 XML and XSLT" New topic
Author

JSF2 XML and XSLT

Thiebaut olivier
Greenhorn

Joined: Jul 10, 2008
Posts: 14
Hey,


I'm developping a JSF's application, with facelets, but for some reasons, i try to print JSF pages with XSL ( XML and XSLT templates).
Do you think it's possible ? A JSF Page with a part XSL ?

Olivier
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15958
    
  19

Mssr. Olivier, I regret to inform you that your first name isn't displaying properly. My attempt to decode it failed, since the alleged hex code for the mangled character is "bdbf" and that doesn't decode sensibly according to any of the schemes I can think of. What is the "code page" setting of your web browser? And is there a purely 7-bit alternative like "oe" for "ö" or "n~" for "ñ"?

Anyway, in answer to your question, JSF is primarily intended to take an abstract component tree and render it as HTML. In the case of Facelets, the original xhtml source is officially known as "View Template Language" (VTL) or "View Definition Language" (VDL). The two terms are equivalent.

Any XSLT processes would have to be done internally and rendered via an h:outputText element as mixing VDL and non-JSF XML would be like mixing Java and COBOL, so to speak. You can do it, but not in the same source.


Customer surveys are for companies who didn't pay proper attention to begin with.
Thiebaut olivier
Greenhorn

Joined: Jul 10, 2008
Posts: 14
Thanks,

My fisrt name isn't displaying correctly because there is an accent on the 'e', I try to correct this mistake.

If i understand corretly your answer, i must use a XSLT processes in server side (like xalan) and use the command hutpuText to
display the result ?

In fact, i try to create a dynamic survey, but the results must be save in database.
The xml is more flexible, to create a page.
On other reason pushing me in this direction. The creation of the survey is in Java, but the uses is in PHP.
XML is language independent.


Olivier
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15958
    
  19

OK. Let me try: Thiébaut. How did that work?

You could run Xalan and capture its output to go to a JSF text output property.

Or it's possible that the entire page would be better off done in 100% XML, in which case you would not use JSF for that particular page.

I am not totally certain what's required here, but you don't need XML solely because you have mixed JSF and PHP servers.
Thiebaut olivier
Greenhorn

Joined: Jul 10, 2008
Posts: 14
Thanks Tim,

I'll try to be clearer.

A user can produce a 'survey', with an administration console developping with JSF.
When the survey is ok (workflow, validation) hte result will be display in an another
application which uses PHP.
The store in XML is a solution for this.
But I want to use XSLT, to display just the survey in JSF or PHP solution.
I can uses XSLT, just for this part but in all application there is a header, footer ...
And this part are in JSF or PHP.

Olivier
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15958
    
  19

I would recommend creating a traditional servlet running xalan and routing its output to the Response output stream. Not every component of a JSF app has to actually be JSF. You can share internal data with non-JSF servlets and JSPs using session-scope objects.
Thiebaut olivier
Greenhorn

Joined: Jul 10, 2008
Posts: 14
Thanks TIM,

I think this is the best solution, I had thought, but i wanted an outsider's view.

Thank you again for your patience

Olivier
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF2 XML and XSLT
 
Similar Threads
xsl and xslt
To author
Trees in JSF?
How to display trees in JavaScript?
Which one is the best XML parser?