| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1734 人关注过本帖
标题:[转帖]关于strut的一些讨论
只看楼主 加入收藏
helloworld
Rank: 1
等 级:新手上路
帖 子:185
专家分:0
注 册:2004-8-27
收藏
 问题点数:0 回复次数:5 
[转帖]关于strut的一些讨论

I think Struts is a really nice implementation of MVC. It's certainly a lot quicker and easier to use than writing one yourself - I know, I've done both!

If you have a specific question relating to Struts, I'll try to answer it.

Re: Is Struts the most popular J2ee framework? Author: ivanbatty In Reply T Re: Is Struts the most popular J2ee framework? Feb 12, 2002 10:33 AM

Reply 3 of 39 I'd like to use struts instead of petstore for my future application. The only problem is the implementation of an EJB framework on struts. You have to do it by yourself, and perhaps it could be too slow to implement!

Let me know your experience.

thanx

Re: Is Struts the most popular J2ee framework? Author: ken_robinson In Reply T Is Struts the most popular J2ee framework? Feb 12, 2002 11:02 AM

Reply 4 of 39 I work in an environment where we must use STRUTS. My personal opinion of it is that it is worthless.

Keep in mind, I prefer system performance over anything else, and STRUTS does add overhead.

In my opinion, STRUTS is smoke and mirrors. Instead of using the HttpRequest object to look for parameters, STRUTS requires that you build and object that extends the ActionForm (if I have the wrong name, please correct me). The set methods in this form must match the name of the parameter coming in (a TextBox with the name jimbo will only be set in a object with a setJimbo() method). Now, regardless of if you use the Request object or STRUTS form, you still need to know the names of the parameters you are looking for.

STRUTS then forwards the ActionForm to an Action. This is for the work you want to do. A Servlet calls the doPost/doGet to do this.

STRUTS allows for a Mapping type structure. Using a return value from the logic you've coded, it determines which JSP page to forward the request to. This can be done very easy without STRUTS.

In my opinion, it is MUCH better to learn the Java Servlet specs instead of STRUTS. The arguement for using STRUTS is that it gives you an MVC environment. If you think about this, the Servlet Container gives this to you already. The client (Brower) is the view. Only the HTML/WML you send is seen by the client. JSPs where created just for this purpose. The web container and servlets you develop are the controller. When you deploy a servlet, you can configure the URL or URL pattern that servlet will answer for. Servlets should only verify the incoming data and prepare the outgoing data. The JSP (view) will take that data and format it for the client. The Model is of course any data (usually a JDBC Database) that is used to perform the requested logic.

Why this needs to be changed is beyond me, especially considering the Servlet spec provides for everything you should need.

Re: Is Struts the most popular J2ee framework? Author: SAFM3 In Reply T Re: Is Struts the most popular J2ee framework? Feb 12, 2002 12:02 PM

Reply 5 of 39 I agree with you Ken, 100%

I am currently involved in building reusable frameworks for our web infrastructure. One of these frameworks is a template implemenetation of the Front Controller pattern. I thought about using Struts instead of writing the code myself, but since Struts is not a standard, and, not to mention, implementing Front Controller is not very difficult, I choose to write the framework instead.

I'm a firm believer in using frameworks, but there are some that are worthless, such as Struts. The overhead involved in learning Struts and customizing it for your environment can be spent writing the entire framework yourself. You will also learn much more about the Servlet API, as Ken mentioned, if you write the framework yourself.

Even though Struts is 100% Java, it's still a 3rd party proprietary API, which means that if you implement it, your are dependent on it. Always stick to standards.

SAF

Re: Is Struts the most popular J2ee framework? Author: chiltown In Reply T Re: Is Struts the most popular J2ee framework? Feb 18, 2002 6:42 AM

Reply 6 of 39 While struts is a 3rd party API, I would not be suprised if it became part of the J2EE servlet, JSP specification.

Re: Is Struts the most popular J2ee framework? Author: ken_robinson In Reply T Re: Is Struts the most popular J2ee framework? Feb 18, 2002 12:37 PM

Reply 7 of 39 Why would you be surprised if STRUTS became a standard?

Everything STRUTS allows you to do can already be done. Why would SUN add the overhead of STRUTS while adding no new functionality?

Learn the Servlet/JSP specification, you'll be MUCH better off.

Re: Is Struts the most popular J2ee framework? Author: swatdba In Reply T Is Struts the most popular J2ee framework? Feb 18, 2002 12:57 PM

Reply 8 of 39 There are a couple alternatives. One is XMLC by Enhydra and an increasingly popular one is webwork which is Rickard Obergs project on SourceForge.

http://sourceforge.net/projects/webwork

Re: Is Struts the most popular J2ee framework? Author: Howlingmad In Reply T Is Struts the most popular J2ee framework? Feb 20, 2002 5:10 AM

Reply 9 of 39 Ken, i wouldn't call Struts worthless. It depends on what you're trying to do and what skills you're having in your company. While Struts is definitely useful for your web-centric applications, you'll need something else for your EJB-centric applications. While servlets are cool, i'm very happy with Struts' form handling. If you prefer system performance over anything else, you'll almost always end up writing something by yourself. But what about contributing your performance tipps to the Struts developers?

SAF, i have to disagree with your 'The overhead involved in learning Struts and customizing it for your environment can be spent writing the entire framework yourself.' For me this was simply not true. When i started with Struts, it was somewhat difficult to get recent documentation but this has changed. If you have a look at the Struts resources, you'll find a bunch of articles, papers and the like. For 3rd party proprietary APIs: the Apache Software Foundation develops Struts, not somebody as proprietary as for example Microsoft. Struts lead developer is a member of JSR052 and you get the full source code.

'Everything STRUTS allows you to do can already be done.' Well, everything Java allows you to do can already be done with C++. So why not stick with this ISO standard?

And finally: this is version 1.0! Not much other software is that useful in such an early release. I'm personally very happy with Struts and recommend it for web-centric applications.

Markus

Re: Is Struts the most popular J2ee framework? Author: ken_robinson In Reply T Re: Is Struts the most popular J2ee framework? Feb 25, 2002 9:33 AM

Reply 10 of 39 If it where my money I was spending to build an app, I would no doubt require that the J2EE servlet spec be used.

In my opinion, any java web developer worth their weight will know servlets. This gives me a larger pool of talent to select from and allows for zero time training on a internal/3rd party API.

I believe that there is ZERO reason to build a 'framework'. Again, I think the Servlet API is more than what is needed.

Sometimes I think people get sucked into the idea of following certain buzzwords like 'pattern' and 'framework'. EVERY application will have it's own requirments. I want to hire the person who can look at a set of requirements and build an app using industry standard tools.

Just because you CAN fit an app into a pattern does not say you SHOULD make it fit a pattern.

As for frameworks, the application itself should dictate how it is built. Too many times I have seen a simple problem solved in a way to requires too much overhead, just to conform to the current 'framework'. Frameworks should only be used when they lower development/training time, not just to have one.

Re: Is Struts the most popular J2ee framework? Author: Howlingmad In Reply T Re: Is Struts the most popular J2ee framework? Feb 26, 2002 9:09 AM

Reply 11 of 39 ken, i agree with you that frameworks, patterns and the like can be used and abused (which applies to every technology, of course). One should only use a framework if it helps to solve the task at hand. And yes, servlets are essential for web development. Anyway, i'll continue to have a look at frameworks and patterns and i encourage everybody to do the same. They give us something to think about, even if we don't use them.

Markus

Re: Is Struts the most popular J2ee framework? Author: scsulliv In Reply T Is Struts the most popular J2ee framework? Feb 26, 2002 12:37 PM

Reply 12 of 39

Struts resources:

http://jakarta.apache.org/struts/index.html

http://www-106.ibm.com/developerworks/ibm/library/j-struts/

Alternatives to Struts:

Tea

http://opensource.go.com/Tea/index.html

XMLC

http://xmlc.enhydra.org/

WebWork

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

Tapestry:

http://tapestry.sourceforge.net/

Maverick

http://mav.sourceforge.net/

Velocity:

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

WebMacr

http://www.webmacro.org/

Jetspeed:

http://jakarta.apache.org/jetspeed/site/index.html

Jakarta Taglibs: http://jakarta.apache.org/taglibs/index.html

Barracuda: http://barracuda.enhydra.org/index.html

Freemarker:

http://freemarker.sourceforge.net/

JSPTAGS: http://sourceforge.net/projects/jsptags

Related information:

http://barracuda.enhydra.org/cvs_source/Barracuda/docs/landscape.html

http://java.sun.com/products/jsp/

http://java.sun.com/blueprints/patterns/j2ee_patterns/model_view_controller/

Re: Is Struts the most popular J2ee framework? Author: MartinS. In Reply T Is Struts the most popular J2ee framework? Feb 27, 2002 10:09 AM

Reply 13 of 39 > Re: Is Struts the most popular J2ee framework? > Is there any other popular J2ee framework easy to use?

I think most Enterprises currently working in J2EE, roll their own J2EE frameworks. (I'm on my second), this is mainly because Struts is only just becoming complete. I think that in the future this is likely to change with a lot of late adoptors of J2EE starting to use Struts.

Re: Is Struts the most popular J2ee framework? Author: Howlingmad In Reply T Re: Is Struts the most popular J2ee framework? Feb 27, 2002 11:47 PM

Reply 14 of 39 > I think most Enterprises currently working in J2EE, roll their own J2EE frameworks.

Hrm, object-oriented programming has promised code-reuse for years now (or was that decades?), but still fails. When will this dream come true? Anyway, i'm having the impression that code-reuse works better for Java as for C++.

Thank god we're already in the 'post OOP era' and we're now entering the 'component-oriented programming era' which will do better, of course

搜索更多相关主题的帖子: strut framework 转帖 Struts Reply 
2004-09-14 13:22
jerryxlm
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2004-8-17
收藏
得分:0 
老大,不要用什么我们看不懂的文字来发表,显得你英文老好的样子,实在一点,用中文吧!!!
2004-09-14 15:28
helloworld
Rank: 1
等 级:新手上路
帖 子:185
专家分:0
注 册:2004-8-27
收藏
得分:0 

嗯,我也比较喜欢看中文的,但是目前关于这些方面的资料还是英文的比较好,

没有办法,只有努力看了

[此贴子已经被作者于2004-09-14 15:34:59编辑过]


2004-09-14 15:33
遥望
Rank: 1
等 级:新手上路
帖 子:52
专家分:0
注 册:2004-7-1
收藏
得分:0 
要不你翻译一下再发过来?

★★★★★★★★★★ 纵里寻她千百度 蓦然回首 那人却在,灯火阑珊处!
2004-09-15 15:15
helloworld
Rank: 1
等 级:新手上路
帖 子:185
专家分:0
注 册:2004-8-27
收藏
得分:0 

等我忙完这段时间,有空了的话,就翻一下


2004-09-16 09:01
快速回复:[转帖]关于strut的一些讨论
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018215 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved