Criteria for choosing Struts or JavaServer Faces

When you create applications in a dynamic Web project, you can use JavaServer Faces and Struts technologies with or without JSP. The following table gives guidance to help you choose.

Either Struts or JavaServer Faces can provide a useful framework for developing dynamic Web applications. Consider the following table which compares JavaServer Faces, JavaServer Pages, and JSP and Struts.

  JavaServer Faces JavaServer Pages JSP and Struts
Components

  • Rich UI-data-bound components with events provided

  • Custom components

  • Standard tags (JSTL) that are non-UI and very basic

  • Custom components through tag libraries

  • Struts-specific tag library

  • Only very basic, form-bean-bound components provided
Device independence

  • Reader kits that provide device independence

  • None

  • None
Error handling and validation

  • None

  • Validation framework driven by an XML file (

    validation.xml)

Scripting

  • Scripts can be attached to events

  • All components accessible from scripts

  • Embedded Java™ in the page

  • Scripts written in Java

    Action classes

  • Form data but not components accessible
Page flow

  • Simple navigation file (

    faces-config.xml)

  • None

  • Sophisticated, flexible framework

  • XML file based
Session and object management

  • Automatic

  • Manual

  • Manual

 

Related tasks

Creating Web-based user interfaces

Developing Faces (JSF) applications overview

Developing Web applications using Struts