JSF Central - FAQ
JSF Central

 Articles & Books 
FAQ > JavaServer Faces and web application frameworks
How does JSF compare to ASP.NET Web Forms?
Updated: October 20, 2003

JSF is really the Java industry's answer to Microsoft ASP.NET's Web Forms. ASP.NET is roughly equivalent to the Servlet API and JSP, and Web Forms is the user interface component piece of the puzzle. If you use develop Web Forms applications in VisualStudio.NET, you get two-way tools for web GUI development -- you can drag and drop components, modify their properties, and attach client-generated events to server-side code. The visual designer edits a file that contains a mixture of XML tags and HTML code -- the tags map directly to component instances. Code is generally written in a separate class (referred to as "code-behind").

Since JSF solves the same problem as Web Forms, you can do all of those things with it as well. And once the vendors start releasing products, you're guaranteed to have more IDE options. There are, however, a few key architectural differences:

  • ASP.NET and Web Forms support a single templating mechanism; JSF defaults to JSP, but can support alternative template mechanisms as well.
  • Web Forms components support encoding and decoding directly; JSF components can encode and decode themselves directly, but the framework also has extensive support for separate RendererKits and Renderers, which means that the look and feel for an application is pluggable, as long as the layout of the components is constant. RenderKits also allow the same components to support multiple devices easily -- just develop a new RenderKit -- the component itself doesn't have to worry about it.
  • Web Forms applications use the Page Controller pattern -- each page is a class that posts back to itself to handle events. This is much like the VB-style form-based approach (also made popular by Borland's Delphi). JSF, by contrast, uses a more strict MVC approach to event handling -- application events are handled by Action classes (much like Struts), and component events are handled by listeners (traditional JavaBeans event handling). JSF can, however, support the WebForms-style of development as well (the technical details, however, are quite different).
  • Web Forms has extensive support for integration with client-side scripting languages (such as JavaScript); JSF currently has no such explicit support. This means that it's currently easier to write components that use a lot of client-side scripting in Web Forms (and the existing components make heavier use of scripts as well).

RSS feed(all feeds)
RSS feed(JavaServer Faces and web application frameworks)

The Editor's Desk
Inside Facelets
In the Trenches

Site version 1.83  Report web site problems

Copyright (C) 2003-2015 Virtua, Inc. All Rights Reserved. Java, JavaServer Faces, and all Java-based marks are trademarks or registered trademarks of Oracle Corporation. in the United States and other countries. Virtua, Inc. is independent of Oracle Corporation. All other trademarks are the sole property of their respective owners.