Tuesday, February 6, 2007

Jsf and Struts

JSF and Struts

I wanted to put simple summary of different between Jsf and Struts depend only on my little experience .

* Struts :

it is a very popular framework for building web applications , application framework ,representation of the classic Model-View-Controller (MVC) design pattern principles .

Has Actions – Management capabilities, such as Action and DispatchAction which represents all the application requests and dispatches requests to appropriate application components as needed for Controller tier.

Has Form-management capabilities, such as the ActionForm JavaBean that represents the server side state of the input fields on a form, and a validation framework externaliz the configuration of the set of correctness checks to be applied to input field values, plus implement those checks on both the client side and the server side for Model tier.

Has a set of JSP custom tags that can simplify the process of creating the application's HTML markup for the view tier .

Has Tiles framework for layout management, which supports creation of layout templates that can be reused across multiple pages, and thus allows easy modifications to the overall look and feel of an application.

Has Standard configuration "struts-config"file for defining behavior:

- Mapping Action URLs to Action Classes .
- Configuring Action behavior (form bean creation,
validation, return-to-input destination, etc.).
- Mapping Forwards (logical resources) to physical
Pages .
- Defining form beans.

* JSF :

it is a user interface component framework, focuses on the view tier of a Model-View-Controller architecture.

It help to develop the application backend without worrying about HTTP details .

Has Fundamental APIs for user interface components.

Has Event- and listener-model for handling server side events.

Has Value-binding and method-binding-expressions let you bind component properties to objects in your data model and or event handling methods to your business logic, without requiring the components to have any detailed knowledge of the Java classes involved.

Has Converter which is Plug-in for conversion object to string and Validator which is Plug-in for correctness checks on input components

Has Standard configuration "faces-config" file for defining behavior:
- Mapping to Java Bean .
- Configured navigation rules to select the next page(current displayed page , action was invoked, outcome was returned ).



The navigation of Jsf is more clear , easier than struts . JSF provides just the basics for component level validation, while Struts offers a more sophisticated validation mechanism. The important points, though, is that you can code custom validation in JSF if the defaults aren't good enough for your application And all Jsf validation (standard ,Custom or backing beans ) has it’s own phases which stop the Jsf lifecycle competence during failure and also stop your application following . so code and handle all the validation in your business logic if this is not suitable to your application logic .

Which Technology Should I Use?

it may be a good idea to do the Struts-JSF integration library if the application is big and complex. If it's small, it's pretty straight forward to migrate all of it to JSF in one shot J , For a complex user interface the Jsf migration will be better (at least if you're still making user interface changes now and then). For an application with a simple user interface (e.g., mostly simple dynamic output rather than a lot of complex input), or an application that's rarely changed is not important to migrate it to Jsf .

4 comments:

lily said...

Hi,it's very nice but i feel that it only a comparison between a struts and jsf but really it's very good and i know it's only the start really i like it
GOOD LUCK gooo on :)

الحمدلله said...

Well done Sarah,
جعله الله فى ميزان حسناتك
فهو علمُ ينتفع به

yours,
Doaa Sobhy
BT-Applied Technology
www.bt-at.com

Beroz said...

I liked your blog very much.. keep writting ya sarsoora :)

Unknown said...

Hi,i think it's very good idea,it's good start point, and we are waiting the best from you

GOOD LUCK and go on

ربنا يوافقك وجزاك اللة خيراً

regards

Mohamed Agbo