Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF2 XML and XSLT

 
Thiebaut olivier
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Thiebaut olivier
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic