strutsnetui

What is the difference between Apache NetUI and Struts?


What is the difference between JPF (Apache netUI) and Struts? When should I use JPF in web applications? What are the pros and cons about JPF?


Solution

  • Apache Struts is an open-source framework that provides support to Model-View-Controller implementations of web-pages. Its goal is to separate these three parts of the project: the model (application logic that interacts with a database) from the view (HTML pages presented to the client) and the controller (instance that passes information between view and model). It has a tag library that eases the production of form-based applications with server pages.

    NetUI is also a MVC framework that is part of Beehive Project, which aims for the reduction of the necessary code on J2EE projects by using JSR-175 java annotations. NetUI was built atop Struts, and it provides a Page Flow Controller class that separates navigational control from presentation of the web-project, keeping a clean JSP code and enabling the reuse of navigational/flow logic (also, it provides a set of JSP tags for rendering HTML/XHTML).


    Now, regarding your other question about when to use JPF: Page flows control all of the major features of a web application: how users navigate from page to page, user requests, and access to the web application's back-end resources. You should use them when you need this kind of control for your application.

    For example, with normal HTML pages, each page is linked directly to other pages.

    page > page > page > page
    

    When using page flows, pages and actions are interwoven, transparently.

    page > action > page > action > page > action > page
    

    Here is an image to illustrate this situation. The .jsp squares are static pages, while the other ones are JPF controllers.

    Example of JPF controllers use

    You can read more about all of this in the apache beehive documentation, where I got the most of these information.