【正文】
have seen the Struts library grow from 90K to over 270K. I had to modify my examples several times because of changes in Struts, and I am not going to guarantee my examples will work with the version of Struts you download. ? Correct level of abstraction Does Struts provide the correct level of abstraction? What is the proper level of abstraction for the page designer? That is the $64K question. Should we allow a page designer access to Java code in page development? Some frameworks like Velocity say no, and provide yet another language to learn for Web development. There is some validity to limiting Java code access in UI development. Most importantly, give a page designer a little bit of Java, and he will use a lot of Java. I saw this happen all the time in Microsoft ASP development. In ASP development, you were supposed to create COM objects and then write a little ASP script to glue it all together. Instead, the ASP developers would go crazy with ASP script. I would hear Why wait for a COM developer to create it when I can program it directly with VBScript? Struts helps limit the amount of Java code required in a JSP file via tag libraries. One such library is the Logic Tag, which manages conditional generation of output, but this does not prevent the UI developer from going nuts with Java code. Whatever type of framework you decide to use, you should understand the environment in which you are deploying and maintaining the framework. Of course, this task is easier said than done. ? Limited scope Struts is a Webbased MVC solution that is meant be implemented with HTML, JSP files, and servlets. ? J2EE application support Struts requires a servlet container that supports JSP and Servlet specifications. This alone will not solve all your install issues, unless you are using Tomcat . I have had a great deal of problems installing the library with Netscape iPla , which is supposedly the first J2EEpliant application server. I remend visiting the Struts User Mailing List archive (see Resources) when you run into problems. ? Complexity Separating the problem into parts introduces plexity. There is no question that some education will have to go on to understand Struts. With the constant changes occurring, this can be frustrating at times. Wele to the Web. ? Where is... I could point out other issues, for instance, where are the client side validations, adaptable workflow, and dynamic strategy pattern for the controller? However, at this point, it is too easy to be a critic, and some of the issues are insignificant, or are reasonable for a release. The way the Struts team goes at it, Struts might have these features by the time you read this article, or soon after. Future of Struts Things change rapidly in this new age of software development. In less than 5 years, I have seen things go from cgi/perl, to ISAPI/NSAPI, to ASP with VB, and now Java and J2EE. Sun is working hard to adapt changes to the JSP/servlet architecture, just as they have in the past with the Java language and API. You can obtain drafts of the new JSP and Servlet specifications from the Sun Web site. Additionally, a standard tag library for JSP files is appearing. 附錄 B 外文譯文 (譯自: Malcolm Davis. Strutsan opensource MVC implementation [J]. IBM Systems Journal , 2020,44(2):3337.) Struts—— MVC 的一種開放源碼實(shí)現(xiàn) Malcolm Davis 本文介紹 Struts,它是使用 servlet 和 JavaServer Pages 技術(shù)的一種 ModelViewController 實(shí)現(xiàn)。s functionality. The model encapsulates the state of the application. Sometimes the only functionality it contains is state. It knows nothing about the view or controller. ? View The view provides the presentation of the model. It is the look of the application. The view can access the model getters, but it has no knowledge of the setters. In addition, it knows nothing about the controller. The view should be notified when changes to the model occur. ? Controller The controller reacts to the user input. It creates and sets the model. MVC Model 2 The Web brought some unique challenges to software developers, most notably the stateless connection between the client and the server. This stateless behavior made it difficult for the model to notify the view of changes. On the Web, the browser has to requery the server to discover modification to the state of the application. Another noticeable change is that the view uses different technology for implementation than the model or controller. Of course, we could use Java (or PERL, C/C++ or what ever) code to generate HTML. There are several disadvantages to that a