It's not a secret anymore!*
The moose likes JSF and the fly likes struts and jsf difference Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "struts and jsf difference" Watch "struts and jsf difference" New topic
Author

struts and jsf difference

vinaykumar vinay
Greenhorn

Joined: Jun 22, 2012
Posts: 9
The primary advantages of Struts as compared to JavaServer Faces technology are as follows:
Because Struts is a web application framework, it has a more sophisticated controller architecture than does JavaServer Faces technology. It is more sophisticated partly because the application developer can access the controller by creating an Action object that can integrate with the controller, whereas JavaServer Faces technology does not allow access to the controller. In addition, the Struts controller can do things like access control on each Action based on user roles. This functionality is not provided by JavaServer Faces technology.

please explain the above statement if possible with example clearly....

Thank you
Shivom Shukla
Ranch Hand

Joined: Jul 05, 2012
Posts: 77

The primary advantages of Struts as compared to JavaServer Faces technology are as follows:
Because Struts is a web application framework, it has a more sophisticated controller architecture than does JavaServer Faces technology. It is more sophisticated partly because the application developer can access the controller by creating an Action object that can integrate with the controller, whereas JavaServer Faces technology does not allow access to the controller. In addition, the Struts controller can do things like access control on each Action based on user roles. This functionality is not provided by JavaServer Faces technology.


Hi vinaykumar vinay,

Since you cannot access the controller in jsf technology,you are unable to update your page in the current session.

example : If you are using jsf and you want to create a calendar in which if you change the date,the content on your page changes instantly without refreshing...then you are unable t do so..but same can be accomplished in struts... hope it helps...
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

Just be aware that JSF was designed in large part to remedy the deficiencies in Struts, and in fact, some parts of JSF were designed with the direct aid of some of the authors of Struts. There's also a "meet-halfway" project called Shale that was part of that attempt.

Both JSF and JSF are based on the MVC architecture. The main difference is that Struts employs special classes and interfaces to facilitate the creation of Models, Views, and Controllers, but JSF attempts (as much as possible) to employ POJO classes as Models, an XML-based View Definition Language for Views, and the Controllers are almost always pre-supplied.


Since you cannot access the controller in jsf technology,you are unable to update your page in the current session.

example : If you are using jsf and you want to create a calendar in which if you change the date,the content on your page changes instantly without refreshing...then you are unable t do so..but same can be accomplished in struts... hope it helps...


This is a serious misunderstanding of both JSF and Struts. Or more correctly, it's a misunderstanding of the HTTP protocol that underlies JSF, Struts, and the web in general.

HTTP is a pure request/response protocol with requests matched up to responses on a purely 1-to-1 basis. No HTTP server can ever update a web page via an unsolicited response, because not only does the HTTP standard forbid it, but because HTTP does not hold open a continuous connection the way that other client/server protocols do. In fact, it's not possible to send out unsolicited output because except while a request is being processed, there's no place to send the response to/.

We fake it these days using AJAX. But AJAX works for both Struts and JSF, and in fact, there's a thriving trade in AJAX-enabled JSF extension tagsets. To update a calendar in real time, for example, I can set a JSF polling tag in RichFaces that does a partial page refresh of just the calendar on a periodic basis. RichFaces renders an HTML page with the required AJAX code on it that does the periodic requests needed to get updated data and to re-render just the section of the page that needs to be changed.


Customer surveys are for companies who didn't pay proper attention to begin with.
vinaykumar vinay
Greenhorn

Joined: Jun 22, 2012
Posts: 9
thank you for the session concept and Ajax information....

please explain the sentence which is written with bold letter...
and comparison between them with example...

thank you )
 
Consider Paul's rocket mass heater.
 
subject: struts and jsf difference