Alex_87
Alex_87

Reputation: 13

Are there any drawbacks of using technology JSP(instead XHTML) in JSF-2.0?

I used to working with JSP as view technology. But with JSF-2.0, the new push is for developers to use Facelets as their templating technology. But whether this is a serious matter? Will I lose anything if i will continue to use the JSP for views in JSF? Than exactly this technology is better? Is there any fundamental differences between the work XHTML and JSP? I would be very grateful if someone could answer it! Thank you

Upvotes: 1

Views: 1364

Answers (3)

gpeche
gpeche

Reputation: 22514

If you use JSF, you should really be using Facelets instead of JSP, as JSP and JSF do not match really well. The main problem is that the JSP world does not know anything about the JSF life cycle. You can read this article for some examples. Facelets does not have these problems as it was created specifically to match JSF.

Upvotes: 1

kapandron
kapandron

Reputation: 3671

New view scope and the inclusion of Facelets is major improvements of JSF along with support ajax and annotations. This technology is a very important and powerful property in the JSF 2.0. So I would not recommend ignore it without having a necessity.

JSP is discouraged from JSF 2.0, because Facelets provide with a much clearer and flexible mechanism for developing user interfaces than legacy JSP. Facelets are far better for several basic reasons:

  • Facelets tags don't need declaration in a tag library descriptor file(TLD).
  • Attributes in a tag are dynamic and they automatically get mapped to a properties. This is one of the main features not available in JSP is page.
  • Very usable page-templating feature. You define a template that defines a generic layout to all the view pages with the scope for customization.
  • JSP-side of the JSF specification is standing still. None of the new features that involve new tags (composite components, ajax, system events, etc…) are exposed through JSP.
  • In addition, Facelets are faster in execution than JSPs.

In general, JSP as view technology in JSF 2.0 is considered more trouble and difficult to maintain

Upvotes: 3

There is no choice between xhtml and jsp. JSP is a server-side templating mechanism for creating text-based responses to send to the the browser. That text response could be xhtml, html, json, xml, or any other text format. So you can use jsp to create xhtml - you don't choose between them.

Just because you changed the extension doesn't mean you're doing anything different. You're just changing what you call it - there's no particular reason to do so, and it's confusing.

Upvotes: -3

Related Questions