jQuery in Action, 2nd edition*
The moose likes JSF and the fly likes Why JSF? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Why JSF?" Watch "Why JSF?" New topic
Author

Why JSF?

Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10067
    
163

Hi,
I have worked with JSP, Struts and some web technologies. I have heard about JSF but never worked with the same. Is JSF just a set of JSP tags that help developers create JSPs easily? Does JSF have anything more than this? Also, if the main goal of JSF is to help creating complex JSPs, is JSF not suitable for a small, less complex web UI? Will it be more of a overhead?


[My Blog] [JavaRanch Journal]
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
This thread discussing similar stuff.
Fintan Conway
Ranch Hand

Joined: Apr 03, 2002
Posts: 141
Originally posted by jaikiran pai:
Hi,
I have worked with JSP, Struts and some web technologies. I have heard about JSF but never worked with the same. Is JSF just a set of JSP tags that help developers create JSPs easily? Does JSF have anything more than this? Also, if the main goal of JSF is to help creating complex JSPs, is JSF not suitable for a small, less complex web UI? Will it be more of a overhead?


Hi Jaikiran,

JSF is a lot more than a set of tags to write JSP pages.
JSF is a full MVC (Model-View-Controller) framework for web applications, this allows you to separate the view rendering technology from the rest of the application - so you could be marking up in wml, xhtml or your own custom format.

JSF is a component-oriented, event-based framework. Component-oriented means that you can use components that have already been developed by others without having to worry about how they work and just drop them into your web page. Also, you can create your own components and reuse them throughout any of your applications.

Event-based means that JSF can respond to user interactions. E.g. if you choose a language from a drop down list (English, German, French, etc.) JSF will receive that event and can respond by returning a localised version of the page in the chosen language.

JSF also includes things like validation of user inputs, takes care of the conversion from text strings on the web page to java types (int, Object, Number, etc.), internationalisation and dynamic page navigation.

This only scratches the surface of what JSF can do. It is really powerful.

Regards,

Fintan
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10067
    
163

Thanks guys for pointing to the thread and explaining about JSF.

Fintan Conway, you mention that JSF is component-oriented, which allows applications to reuse existing UI components. Also, it takes care of validations and internationalization. All this looks almost similar(or do i say same) to what Struts provides. So, how's JSF different from Struts or are they two different things completely?
You also, mentioned that JSF is event-oriented. This is something new and different as compared to Struts. But it certainly reminds me of JavaScript.
Fintan Conway
Ranch Hand

Joined: Apr 03, 2002
Posts: 141
Originally posted by jaikiran pai:
So, how's JSF different from Struts or are they two different things completely?
You also, mentioned that JSF is event-oriented. This is something new and different as compared to Struts. But it certainly reminds me of JavaScript.


Hi Jaikiran,

See my reply in this thread.

JSF manages the component state and events on the server side. No javascript necessary (unless you want to use javascript).

Regards,

Fintan
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10067
    
163

Thanks Fintan Conway, that thread helped in understanding the difference. Just one final question, is it possible to use Struts as a controller framework in my application and also use JSF just as a UI framework? You might ask me, why would i want to do that. As you mention, JSF allows rendering in HTML, WML, xHTML, or own custom-defined format. So if i want to leverage this in my *existing Struts application* would i have to do away with Struts controller along with my existing UI(JSPs). Or can i continue to use Struts as my controller and let JSF handle the UI part. Just curious.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10067
    
163

JSF manages the component state and events on the server side


Does this mean that every event on the UI is propagated to the server? This is different from Javascript, where the events are handled by the client.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by Fintan Conway:
JSF manages the component state and events on the server side.


Let me make it clear that for managing component state you can choose between server and client. You just need to configure it in your configuration file, faces-config.xml.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by jaikiran pai:
This is different from Javascript, where the events are handled by the client.


Yes.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10067
    
163

Thanks Adeel and Fintan for explaining about JSF. Really, appreciated.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why JSF?