Topic: Best web framework? Struts or Cocoon

  Print this page

1.Best web framework? Struts or Cocoon Copy to clipboard
Posted by: Julian13
Posted on: 2002-12-10 13:19

I'm studying Struts and Cocoon but would like to explore more web framework if possible. Would you share your experience with Struts and Cocoon or other web framework.

For me, Struts has shorter learning curve over Cocoon and more focus as a framework for web. Cocoon is more generic but has higher flexibility. Cocoon has added support to the XForm specification, something analog to FormBean in Struts, recently make it more robust for web development (though it's in a initial stage). BTW, a portal module which added in Cocoon recently do make it more productive for development.

Reference:
Building XML Portals with Cocoon By Carsten Ziegeler, Matthew Langham
http://www.xml.com/lpt/a/2002/07/24/xmlportal.html

2.Re:Best web framework? Struts or Cocoon [Re: Julian13] Copy to clipboard
Posted by: Julian13
Posted on: 2002-12-10 13:24

FYI: Attached is the presentation slide by Matthew Langham in Oreilly Open Source Convention.

rtal-with-Cocoon.zip (532.29k)

3.They are both excellent framework! [Re: Julian13] Copy to clipboard
Posted by: rainman
Posted on: 2002-12-10 14:33

make lots of sense. Smile

4.Applied in production? [Re: Julian13] Copy to clipboard
Posted by: Julian13
Posted on: 2002-12-10 22:50

Any real life application of these frameworks can be share?

For me, I am more in a research/study mode rather than apply them in real production. The most difficult part I faced is how to put a clear cut between my business logic/domain with the framework.

In ideal, your code should be highly decoupled from the framework such that different framework can be used in different situation. However, most of the tutorial/book/article haven't address these topic. This does stop me being a "pioneer" in the company >.<

have you ever facing my problem too? or you already got a solution of it? pls share. thx.

5.Re:Best web framework? Struts or Cocoon [Re: Julian13] Copy to clipboard
Posted by: floater
Posted on: 2002-12-11 01:07

There is a short description in Jakarta Struct book about a dozen frameworks, you may take a look. It's skeptical, but covers most of the available frameworks and points urls to go details.

Structs and Cocoon are both fairly stable frameworks. they serve different purpose. Structs is tag oriented, it seperates java code and html code. Nice, huh? Yea. But it creates a hell of trouble for page designers. Think about a scenario where you have a uniform user interface and thus you need graphics design to design the prototypes first. Then Photoshop or other graphics tools can not handle those customized tags. And more, since they are customized tags, there is less chance that any future tools would embrace them either. So this is the limitation. Another interesting aspect of Structs is the code. I once dived into their code and felt Structs is not as flexible as I thought. There is no single Java Interface there, this means you can't tear apart of it(They always use abstract classes). On one hand, abstract classes could do the trick. One the other hand, they make structure of customized code nasty. (In fact, they changed from interface to abstract classes)

I like Cocoon. But as you said, the learning curve is steep. The nice thing about Cocoon is the XML part. If you look at all the frameworks for web application, the ouput has to be html/xhtml, the input is some kind of data source, and frameworks are in the middle. The worst case of frameworks is to tie everything together. The best case is to seperate presentation, business logic, etc. In this sense, XML/XSLT is the ultimate tool to do so. So Cocoon is nice. The limitation of Cocoon is the *pipeline* filters and centralized config file. But those filters are pluggable, nice feature.

In general, there are several factors that we need to address in the framework scenario:
1. ease of use, otherwise nobody is willing to learn it. This mean the interfaces to the application developers should be simple, self explained, and well documented.
2. Every component has to be documented, replacable, pluggable(component=a set of class files). This results the nonlinear structure of filters and decentralized config files. A simple demo could be built within 10 minutes, but the 100th application running on top of the same framework is not that easy since it may interact with the 99 applications already installed(some are misconfiged, some are business required). So a black box approach never works.

I've been bit by every keyword in the above, Smile. The scars are still there, Tongue. That's why I am very picky about frameworks. The worst framework I've ever seen in my life so far is a javascript framework. Once, it brought a 10**9 dollar project. Don't and ever create a javascript framework, that's my advice.

And be aware another factor driving a framework you are going to work on: Politics. Once a computer gamer told me: Don't underestimate stupid people in *large* group because you are outnumbered!

I am kind of busy at work now since it's almost the end of the year. Once the crunching is gone, I'll write more about frameworks for the purpose of:
1. sharing experience with each other(The picky, the merrier)
2. build a generic, universal framework based on functionalities.
There are a lot of good developers in this bbs, hopefully with their willingness to share, abilities and dertermination to reach high, we could accomplish this vision.

6.brilliant perspective! [Re: Julian13] Copy to clipboard
Posted by: Julian13
Posted on: 2002-12-12 00:15

floater, very brilliant perspective. I'm looking forward to see your writing.

which Jakarta Struct book you mean? the John Wiley & Sons or the Oreilly one? i would like to have a look of it.

BTW, the idea of LogicSheet and XSP in Cocoon do release her from one-way pipeline. However, it seem not very handy to be used. May be more time I should invest on it. Tongue

7.Re:brilliant perspective! [Re: Julian13] Copy to clipboard
Posted by: floater
Posted on: 2002-12-12 02:37

Julian13 wrote:
floater, very brilliant perspective. I'm looking forward to see your writing.

which Jakarta Struct book you mean? the John Wiley & Sons or the Oreilly one? i would like to have a look of it.

BTW, the idea of LogicSheet and XSP in Cocoon do release her from one-way pipeline. However, it seem not very handy to be used. May be more time I should invest on it. Tongue


I think it's in the Oreilly book.

Good, glad to know Cocoon makes some progress. If they could make a tree structure from LogicSheet and XSP, it's great. Hopefully they have good documents on how to use it.

Glad we could work together to straight something. I myself have a chance to work with several frameworks and have some thoughts/experience. But they scatter around everywhere, I just didn't have time to sit down and straight out things. Also, I hear here and there a lot of good ideas and points from various people. I am sure other folks have the same things too. If we could combine these experience/ideas together, we should be able to come up something. My idea model would be a simple to use/config, easy to plug/unplug. And we should have a very good documents on usage and structure.

Primarily, I think there are 3 ways to deal with web-based applications in java arena:
1. html based templates
2. tag based templates
3. xml/xslt based templates(with html/xhtml ouput to browsers)

The pivoting points are(not all, in no particular order, just pop up from my mind, but important in my view, just my thoughts):
1. Add-on applications should have their own configurations, in their own directories, in property format or xml format. I don't like them to change framework critical settings a lot since I firmly believe users will take every chance to break it, Smile. And users should have a choice of simple property format, and this saves framework from loading xml parsers, etc.

2. application logic should be out of the framework, no matter how loose they are. The idea is to factor the variants out of the invariants.

3. application code should not know whether it's for web-based or not, swing-based say. This is a shaky point that I am not so sure like others. But I think the closer, the better. This means to framework that framework has to a general interface to applications, so that's why I feel shaky.

4. Framework should be able to handle all 3 ways mentioned in the above,
from simple to complex. So users have the extensibility and choices.
Here are some of the reasons that I feel the need to "create" a new framework:
a. html based template approach:
There are a few free html template engines with wich you could substitute the dynamic content, and we make make a simple one in fairly short time. But the limitation I encountered before is of two cases. One is if-then case, for example, if I have point 0, then certain posts have a lock icon; otherwise I don't; Another example, if I am an admin, a field could be a text input field;otherwise, it's a pull down menu. The other case is the tables with rows and headers. Or the combinations of these two cases.
There is another approach here is to compile html code into a java class, and then substitute in the dynamic content. It's working, but bring in unnatural complexity.
b. tag based templates:
Besides JSP, all other tags are customized tags. I don't like any of these approaches is because user interface designers can't work with these tags. Dreamweaver, frontpage, or others can't handle these tags. So we fix one problem by breaking another. I tend to seperate user interface design from functionalities, after all, user interface design is a professional job. However, if someday(maybe now already), there are tools to be able to handle this, it would be nice.
c. xml/xslt approach:
I view this as the ultimate solution. It solves all of the above problems nicely, but the price is also the highest.

I think there is a chance that we could coorperate all three approaches together somewhat(we can't get all of them, but some of them from each way). But I haven't think through the jungles yet.

I found my old notes:
1 and 2 are omitted on purpose, job related.

3. Structs
I went through the source code

4. Barracuda
Event-driven(similar to swing) and XML based

5. Cocoon: xml, nice but pricy!

6. Expresso

7. Freemarker http://freemarker.sourceforge.net

8. velocity http://jakarta.apache.org/velocity

9. WebMacro http://www.webmacro.org

10. Maverick MVC Framework http://mav.sourceforge.net

11. SiteMesh http://www.opensymphony.com/sitemesh

12. Jakarta Turbine http://jakarta.apache.org/turbine

13. WebWork http://sourceforge.net/projects/webwork

14. JavaServer Faces:

Just a few thoughts. We may start exchange thoughts and collect them over the time. And hopfully, more and more people would like to contribute to it. When the time is ready, we could go forward.

disclaim: these are my own view, so could be well well wrong, Smile.

8.just want to know which framework be used in jute? [Re: Julian13] Copy to clipboard
Posted by: abc123
Posted on: 2002-12-12 09:14

which one?
tell us please,rainmanSmile

9.Re:brilliant perspective! [Re: floater] Copy to clipboard
Posted by: Julian13
Posted on: 2002-12-13 11:02

floater wrote:
I think it's in the Oreilly book.
... REMOVED TO SAVE SPACE ...
contribute to it. When the time is ready, we could go forward.


I am more on utilizing the framework instead of developing mine in this stage (though it may be fun and satisfactory ^.^).

I am using a set of tools generating my domain class, data-access class, HTML, JSP and servlet for database centric web application. It does work well in term of user experience since I have added different JavaScript and CSS stuff for interactive user interface (to avoid massive reloading).

Neverless, I am facing difficulty to enrich my backend side like server side validation and connection pool, etc. I believe these can be solved by some framework Thus, I am more focus on the aspects like customizable workflow and business logic. I expect the framework allow me customize the application workflow and business logic on-the-fly with siimple script plus utilizing most of my domain classes.

As you said, XML/XSLT based templates might be the ultimate solution. However, the XML/XSLT itself might be too generic as a framework [for me]. If it can support some open standard XML format world be better. For example, if a framework support XMLSchema to dynamic create HTML frontend and database backend or a framework support BPML (http://www.bpmi.org/) for dynamic processing workflow, etc. This really boost up the speed for development and help developer more focus on the business logic instead of the technical issue.

So far, I think Cocoon is a excellent foundation to what I want. Of course, I will try to study what you have quoted for our reference too. Thank you very much. ^.^

10.Re:brilliant perspective! [Re: Julian13] Copy to clipboard
Posted by: floater
Posted on: 2002-12-13 13:56

Julian13 wrote:
I am more on utilizing the framework instead of developing mine in this stage (though it may be fun and satisfactory ^.^).

I am using a set of tools generating my domain class, data-access class, HTML, JSP and servlet for database centric web application. It does work well in term of user experience since I have added different JavaScript and CSS stuff for interactive user interface (to avoid massive reloading).

Neverless, I am facing difficulty to enrich my backend side like server side validation and connection pool, etc. I believe these can be solved by some framework Thus, I am more focus on the aspects like customizable workflow and business logic. I expect the framework allow me customize the application workflow and business logic on-the-fly with siimple script plus utilizing most of my domain classes.

As you said, XML/XSLT based templates might be the ultimate solution. However, the XML/XSLT itself might be too generic as a framework [for me]. If it can support some open standard XML format world be better. For example, if a framework support XMLSchema to dynamic create HTML frontend and database backend or a framework support BPML (http://www.bpmi.org/) for dynamic processing workflow, etc. This really boost up the speed for development and help developer more focus on the business logic instead of the technical issue.

So far, I think Cocoon is a excellent foundation to what I want. Of course, I will try to study what you have quoted for our reference too. Thank you very much. ^.^

That's ok if you are more interested in utilizing frameworks, since the experience you have on utilization is quite important too, like which part you like, which part you hate.

Sorry, I have no experience on code generating. Couldn't help you on that. But there is a thread here(probably still the next one) talking about realMethods. It seems to me that they use UML(in the strict sense) as the role of your "simple scripts" to generate code. I took a look, it's kind of interesting, a different approach. Also in the news group(Java News) there is an article "Cooper's Manifesto Pushes Developers To Consider A" talking about similar ideas.
Basically, they treat functionalities as invariants, the tech below functionalities as variants. So they build business models on invariant functionalities while vendors use J2EE to generate code to provide those functionalities.

11.Re:Best web framework? Struts or Cocoon [Re: Julian13] Copy to clipboard
Posted by: coder
Posted on: 2002-12-15 13:26

struts不错,不过我不喜欢jsp和taglib,所以,我找了一个strutscx,正在看。
http://it.cappuccinonet.com/strutscx/

特征:
综合运用struts、xml、xsl,No JSP

其它struts+xml的site
http://www.oroad.com/opencode/stxx/index.html
http://www.orbeon.com/oxf/

12.Re:Best web framework? Struts or Cocoon [Re: coder] Copy to clipboard
Posted by: floater
Posted on: 2002-12-15 14:42

coder wrote:
struts不错,不过我不喜欢jsp和taglib,所以,我找了一个strutscx,正在看。
http://it.cappuccinonet.com/strutscx/

特征:
综合运用struts、xml、xsl,No JSP

其它struts+xml的site
http://www.oroad.com/opencode/stxx/index.html
http://www.orbeon.com/oxf/


Interesting ... reading...
Looks like finally someone wants to fix this, Tongue. I don't like customized tags too since they break the user interface code(*sigh*, fix one thing by breaking another).

Thanks a lot for the info.

13.Re:Best web framework? Struts or Cocoon [Re: coder] Copy to clipboard
Posted by: Julian13
Posted on: 2002-12-19 01:20

coder wrote:
http://it.cappuccinonet.com/strutscx/
http://www.oroad.com/opencode/stxx/index.html
http://www.orbeon.com/oxf/


strutscx's Castor part is exactly what i'm looking for! thx a lot. ^.^

14.Re:Best web framework? Struts or Cocoon [Re: coder] Copy to clipboard
Posted by: Julian13
Posted on: 2002-12-19 02:32

coder wrote:
不过我不喜欢jsp和taglib


I don't like TagLib too but find JSP okay for prototyping. Both are good for initial prototypying and presentation purpose. However, the application become hard to maintain when the size growth. The client and server side mess up like a chaos.

I am recently doing a intranet purchasing system for the employee placing order. Since these ordering works are manual intensive, the client require a more interactive and user friendly GUI, for example, text box pop up with available value filtering, auto-filling related field (like selecting template order then fill up the new order), etc. I believe these requirements are typical for client-server application but not so common for the stateless web environment. So, I expected some of the web framework or application has addressed these issue (bad that I'm wrong). Do you think these requirements should be addressed by a framework?

For my initial solution, I have a set of JavaScripts and JSPs generated according to the database schema such that my HTML form can utilize them for auto data retrieve and form filling (They work closely with some auto-generated servlet, domain and DAO classes as I mention before). A prior solution about JavaScript-Applet has been done too. However, it has higher barrier than using JavaScript and JSP. My generated code work siimilar to the following links: http://www.aspfree.com/authors/Dario_Medele/masterdetail.ASP
http://ashleyit.com/rs/jsrs/select/php/select.php
Any comment for my solution?

Hopefully my work can be saved from a better framework in near future.

15.Re:Best web framework? Struts or Cocoon [Re: Julian13] Copy to clipboard
Posted by: floater
Posted on: 2002-12-19 04:13

Julian13 wrote:
I don't like TagLib too but find JSP okay for prototyping. Both are good for initial prototypying and presentation purpose. However, the application become hard to maintain when the size growth. The client and server side mess up like a chaos.

I am recently doing a intranet purchasing system for the employee placing order. Since these ordering works are manual intensive, the client require a more interactive and user friendly GUI, for example, text box pop up with available value filtering, auto-filling related field (like selecting template order then fill up the new order), etc. I believe these requirements are typical for client-server application but not so common for the stateless web environment. So, I expected some of the web framework or application has addressed these issue (bad that I'm wrong). Do you think these requirements should be addressed by a framework?

For my initial solution, I have a set of JavaScripts and JSPs generated according to the database schema such that my HTML form can utilize them for auto data retrieve and form filling (They work closely with some auto-generated servlet, domain and DAO classes as I mention before). A prior solution about JavaScript-Applet has been done too. However, it has higher barrier than using JavaScript and JSP. My generated code work siimilar to the following links: http://www.aspfree.com/authors/Dario_Medele/masterdetail.ASP
http://ashleyit.com/rs/jsrs/select/php/select.php
Any comment for my solution?

Hopefully my work can be saved from a better framework in near future.


Here is my personal opinion:
1. I had the same experience described in your first paragraph. Just a mess.
2. The bottom line of your second paragraph is the structural change in your html file. For example, if you need to populate the data into a pulldown menu, or if you want to have a popup layer for a calendar, say.
These are not only the dynamic value, but also the dynamic structure.
I mentioned this in other posts too. But unfortunately, no easy solution for this.

Since we have to somehow generate the dynamic portion of html code, your way is certainly working, as long as you maintain the javascript to the minimal(otherwise, it's overwhelming and certainly killing), in my opinion.
In fact, I did once for the sorting of table rows - using a javascript to do the sorting and populate the data to javascript(Now jdbc 2 could do it).
The bottom line is to isolate javascripts and data manipulated by javascripts.

One more comment for javascript and tags. Javascripts are hidden in browsers unless we trigger them. So they have no effect on appearance of pages. But tags are not:
<mytag key=ee/>
msg
<mytag>abcdef</mytag>
The first one is hidden, the second tag is not because the middle content is shown. So I prefer javascripts than tags. I think people ignore this solution is because:
a. javascript is not really java
b. people using javascripts tend to create a huge framework(>100K). This cause the loooong download time for the first page(when caches are on).
Otherwise, I think it's a pretty good solution for servlets/templates. (I used this framwork four years ago when I worked for another company.)

Of course, that wonderful and saving-java-world StructCX is more promising (and thus more costly).

I also have an inquiry about your code generating code. Suppose you finish a project like this, use a bunch of class to generate other classes.
How hard to modify the generating code to get the generated code if there is some change? I have no experience on this, but I am wondering how easy to break some code when you modify the generators because everything is tied up. And the debug is not easy, I imagine. Just curious. I always believe the rule: factor out the invariants and work on the variants.
But this kind of code-generates-code approach at the application level is kind of interesting(applications are a little bit unpredictable, nothing like from jsp to servlet rules).

16.Re:Best web framework? Struts or Cocoon [Re: floater] Copy to clipboard
Posted by: Julian13
Posted on: 2002-12-20 10:04

floater wrote:
I also have an inquiry about your code generating code. Suppose you finish a project like this, use a bunch of class to generate other classes.
How hard to modify the generating code to get the generated code if there is some change? I have no experience on this, but I am wondering how easy to break some code when you modify the generators because everything is tied up. And the debug is not easy, I imagine. Just curious. I always believe the rule: factor out the invariants and work on the variants.
But this kind of code-generates-code approach at the application level is kind of interesting(applications are a little bit unpredictable, nothing like from jsp to servlet rules).


You are right that it's easy to break the final code if anything goes wrong in the generator. however the same apply if a bug is fixed in the generator, it populate to all the final code too. ^.^ the generator is not any innovative application; or it's simply performing some dummy text appending job. however, it does saving my time from lots of typing. especially as my code has more pattern being used.

admitted that the debugging task is not trivial at the first thought. nevertheless, you can separate out the final code from the generator. For the final code, I'm using JUnit to test the business logic (basically the database CRUD + master-detail stuff). For the generator, I'm using some program to diff the generator code from my manual-typed code. such that I can focus on the business design once the generator code settle down.

the extreme case is I have not enough time fixing the generator. thus, i can manually change the generated code as no choice at all. of course, fixing the generator seems more productive in my case.

17.Re:Best web framework? Struts or Cocoon [Re: Julian13] Copy to clipboard
Posted by: floater
Posted on: 2002-12-20 23:48

Julian13 wrote:
You are right that it's easy to break the final code if anything goes wrong in the generator. however the same apply if a bug is fixed in the generator, it populate to all the final code too. ^.^ the generator is not any innovative application; or it's simply performing some dummy text appending job. however, it does saving my time from lots of typing. especially as my code has more pattern being used.

admitted that the debugging task is not trivial at the first thought. nevertheless, you can separate out the final code from the generator. For the final code, I'm using JUnit to test the business logic (basically the database CRUD + master-detail stuff). For the generator, I'm using some program to diff the generator code from my manual-typed code. such that I can focus on the business design once the generator code settle down.

the extreme case is I have not enough time fixing the generator. thus, i can manually change the generated code as no choice at all. of course, fixing the generator seems more productive in my case.


Well done, man. In general, in order to avoid repetitive coding, we use OOP, especially in java. write once and only once. encapsulate common code in a superclass. But in your case, there are db and javascript too, looks like a banquet, Smile.

IBM visual age has a similar too to generate javabean code from db2 tables.
It's pretty convenient too. I think it has the same idea as yours. But I think you combine JUnit testing into it, that's good idea, must have saved you a lot of time.


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923