aspose file tools*
The moose likes JSF and the fly likes Are JSF 2.0 Facelets really XHTML-conform? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Are JSF 2.0 Facelets really XHTML-conform?" Watch "Are JSF 2.0 Facelets really XHTML-conform?" New topic
Author

Are JSF 2.0 Facelets really XHTML-conform?

Kai Wähner
Ranch Hand

Joined: Sep 16, 2009
Posts: 76
Hi.

As I have read so far, a huge improvement of JSF 2.0 towards 1.2 is the usage of Facelets instead of JSPs, which are XHTML-conform and so could be designed with HTML-Tools, right?

This is why many developers prefer Wicket or Tapestry, where the development of the view is possible with HTML-Tags and no taglibs or other code.

But in a JSF 2.0 Hello World example you can see this:





The JavaBean is accessed via #{helloWorldBean.now}. That is not XHTML-conform, isn't it?

So maybe I do not understand it correctly - JSF 2.0 is still not pure HTML such as e.g. Wicket tags (e.g. <form wicket:id="form" /> )?

Thanks for explanations...


My IT-blog about my experiences with: Java / JEE, IT Conferences and IT Certifications

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16228
    
  21

Well, technically, I wouldn't really call them XHTML. In fact, JSF in general has not done well with any variant of HTML in its views.

JSF and Facelets are not precisely the same thing, although Facelets does become part of basic JSF in JSF2. I don't remember the precise allowable formats, but the one I've always used is an XML format, and yes, I put the filename ".xhtml" on them, but that's a notational convenience.

A "pure" JSF/Facelets view would ideally not have any actual HTML in it at all, so as to make it possible to use the same view source with different renderers such as one for WAP. That's what I generally try to do these days, although I must admit when you need row/column spanning capabilities in core JSF, the work-arounds are really annoying.


Customer surveys are for companies who didn't pay proper attention to begin with.
Rainer Eschen
author
Ranch Hand

Joined: Jan 24, 2009
Posts: 75
Where do you found this example? It should be



or in a more Facelets writing



ICEfaces book . ICEcube . ICEfusion . Scrum
Kai Wähner
Ranch Hand

Joined: Sep 16, 2009
Posts: 76
Where do you found this example?


Sorry, I do not remember anymore...

But besides this syntax error, any other opinions to my question besides Tim?

A colleague told me: Yes, it still is pure XHTML syntax - but of course, a pure (X)HTML editor cannot show any value for the bean.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16228
    
  21

Kai Waehner wrote:
Where do you found this example?


Sorry, I do not remember anymore...

But besides this syntax error, any other opinions to my question besides Tim?

A colleague told me: Yes, it still is pure XHTML syntax - but of course, a pure (X)HTML editor cannot show any value for the bean.


Actually, even in Facelets, it's often better to use the outputText control. For one thing, the container components such as panelGrid can be a little touchy about recognizing free-form text as discrete child elements. For another, you don't get the side benefits like styling options that are available from the outputText tag, so you'd have to use a div or span. Finally, if you have any intent of ever rendering the form to a different media (like PDF) or destination (small-screen device such as a cellphone), using raw HTML can at best reduce portability and at worst end up as part of the displayed text in the output.
Rainer Eschen
author
Ranch Hand

Joined: Jan 24, 2009
Posts: 75
The question is: is it really important ta have a conform syntax? The most of us use an IDE-based editor that supports JSF natively or can handle XML. So, HTML editors are used (in theory) by web designers who prepare the presentation of a page and the developer is doing the rest (add EL stuff). But, reality shows that developers play both roles in a lot of cases.

Sure, Facelets are described to support editing in a standard HTML editor. But, the most important part are the possibilities that Facelets deliver to get reuse:

* Templating
* Tags to define

Kai Wähner
Ranch Hand

Joined: Sep 16, 2009
Posts: 76
So, HTML editors are used (in theory) by web designers who prepare the presentation of a page and the developer is doing the rest (add EL stuff). But, reality shows that developers play both roles in a lot of cases.


I agree with you 100 percent! The question came up because I am doing an evaluation of different web frameworks at the moment, and some guys think this is an important advantage - in huge projects, with some designers :-)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Are JSF 2.0 Facelets really XHTML-conform?