Cocoon XMLForms compared with Jakarta Struts

Struts is 3 parts:

  1. An URL map, matching URLs to Actions.

Everything you can do with struts-config.xml (Struts), you can do with sitemap.xmap (Cocoon).

2. Custom JSP tags for rendering HTML, like i18n, access to JavaBean properties and others. Cocoon's set of transformers is a superset of Strut's visual tags.

3. Form handling. Automated binding between HTML input fields and JavaBeans. Cocoon's XMLForm does that and much more. It not only provides the binding, but it does it in a browser independent way. Struts is only designed to handle automatically HTML input.

For fairness sake, I will tell you that over the last 2 years I have used Struts successfully in big enterprise projects. It is a good and sound technology when you are only interested to support the major HTML browsers and you are not concerned with other interfaces to your application like WML, VXML, Web Services, etc.

Note from another reader:

One certainly could use struts for VXML and WML as well as HTML. I've done it before. By examing the http header, a struts action say "determine medium" decides which medium a client is using when entering the web site. If for example a user is calling in from a phone, then the struts action returns VXML as a forward. If the user enters from a computer browser, then the struts action returns HTML as a forward. The struts URL mapping then directs flow to JSPs that output the appropriate content. Your web application would have 3 sets of JSPs. One for HTML, one for VXML, and one for WML. In this scenario, no XML transformations occur. Most all of your struts actions and generic tag libs would be reused as is on all the JSPs regardless of the output content type.

End of note from another reader.

My recommendation is, if you are in a hurry and you don't want to invest time in learning a new technology, go Struts.

If you plan to build a lot of web applications in the future, you must learn Cocoon. It will add a very powerful weapon to your software tools arsenal. You don't have to use it all the time, but when things start to look dangerously complex, you will find it to be a life saver.


authors:

written by: IvelinIvanov - one of the architects of Cocoon XMLForms (source in the mail archive)

added by: ReinhardPoetz (source in the mail archive)


It is also possible to use XMLForms with Struts. Stxx is a Struts extension that adds XML processing support to Struts (much more limited than Cocoon, however a Cocoon plugin is in the works). Stxx supports the use of XMLForm by wrapping Struts ActionForms.

  • No labels