Author: husted Date: Sat Jul 15 18:35:07 2006 New Revision: 422333 URL: http://svn.apache.org/viewvc?rev=422333&view=rev Log: STR 2910 Add AJAX, SOAP, and MVC to primer.
Modified: struts/site/src/site/fml/roadmap.fml struts/site/src/site/xdoc/primer.xml Modified: struts/site/src/site/fml/roadmap.fml URL: http://svn.apache.org/viewvc/struts/site/src/site/fml/roadmap.fml?rev=422333&r1=422332&r2=422333&view=diff ============================================================================== --- struts/site/src/site/fml/roadmap.fml (original) +++ struts/site/src/site/fml/roadmap.fml Sat Jul 15 18:35:07 2006 @@ -162,16 +162,26 @@ probably find a MVC framework useful. </p> <p> - When choosing a framework, an important consideration is - which user interface technology you would like to use: + When choosing a framework, two keys considerations are + which user interface technology and which version of Java + you would like to use. + Popular user interface technologies include <a href="http://java.sun.com/j2ee/javaserverfaces/">JavaServer Faces</a> - (JSF), - conventional + (JSF), conventional <a href="http://java.sun.com/products/jsp/">JavaServer Pages</a> (JSP), - or another templating technology like + and templating technologies like <a href="http://jakarta.apache.org/velocity/">Velocity.</a> + Another popular UI technology to consider is + <a href="http://www.adaptivepath.com/publications/essays/archives/000385.php"> + AJAX.</a> + </p> + <p> + (For more about the technologies underlying modern web + applications, see the + <a href="../primer.html"> + Key Technologies</a> primer.) </p> <p> While both Struts 1 and 2 support JSP, Velocity, and XSLT, Modified: struts/site/src/site/xdoc/primer.xml URL: http://svn.apache.org/viewvc/struts/site/src/site/xdoc/primer.xml?rev=422333&r1=422332&r2=422333&view=diff ============================================================================== --- struts/site/src/site/xdoc/primer.xml (original) +++ struts/site/src/site/xdoc/primer.xml Sat Jul 15 18:35:07 2006 @@ -52,6 +52,9 @@ <a href="#cycle">The HTTP Request/Response Cycle</a> </li> <li> + <a href="#javascript">JavaScript, AJAX, and SOAP</a> + </li> + <li> <a href="#java">The Java Language and Application Frameworks</a> </li> @@ -63,20 +66,20 @@ ResourceBundles</a> </li> <li> - <a href="#servlets">Java Servlets</a> + <a href="#servlets">Java Servlets and Web Containers</a> </li> <li> <a href="#jsp">JavaServer Pages and JSP Tag Libraries</a> </li> <li> - <a href="#xml">Extensible Markup Language</a> + <a href="#xml">Extensible Markup Language (XML)</a> </li> <li> <a href="#jaas">JAAS</a> </li> <li> - <a href="#layers">Other Layers</a> + <a href="#mvc">Model View Controller</a> </li> </ul> @@ -88,7 +91,8 @@ technology. </p> - <p id="JavaWebServicesTutorial">If you are familiar with Java, + <p> + If you are familiar with Java, but not these technologies, the best overall starting point is <a href="http://java.sun.com/j2ee/tutorial/1_3-fcs/index.html"> @@ -100,7 +104,8 @@ format. </p> - <p>If you've created web applications for other platforms, you + <p> + If you've created web applications for other platforms, you may be able to follow along and visit the other references as needed. The core technologies used by the framework are @@ -109,7 +114,8 @@ useful in any Java project. </p> - <p id="jt">If you are not familiar with the Java language + <p> + If you are not familiar with the Java language generally, then the best starting point is <a href="http://java.sun.com/docs/books/tutorial/index.html"> @@ -132,7 +138,8 @@ <a name="http"/> <subsection name="HTTP, HTML and User Agents"> - <p>The World Wide Web was built over the Hypertext Transfer + <p> + The World Wide Web was built over the Hypertext Transfer Protocol <a href="http://www.ietf.org/rfc/rfc2616.txt?number=2616"> (HTTP)</a> @@ -145,7 +152,8 @@ the Web and web applications. </p> - <p>While building web applications, some Java developers + <p> + While building web applications, some Java developers write their own HTML. Others leave that responsibility to the page designers.</p> @@ -192,7 +200,8 @@ <a name="cycle"/> <subsection name="The HTTP Request/Response cycle"> - <p>A very important part of HTTP for the web developer is the + <p> + A very important part of HTTP for the web developer is the request/response cycle. To use HTTP you have to make a request. A HTTP server, like a web server, is then obliged to respond. When you @@ -213,11 +222,71 @@ </subsection> + <a name="javascript"/> + <subsection + name="JavaScript, AJAX, and SOAP"> + + <p> + A problem with the HTTP request/response cycle is that + it does not promote an interactive user interface. + Web developers often resort to scripting language, + like JavaScript, to make web applications more + interesting. + </p> + <p> + An advanced usage of JavaScript, called AJAX, can + help developers create web applications that are as + interactive and responsive as desktop applications. + </p> + + <p>For more about JavaScript and AJAX, see</p> + + <ul> + <li> + <a href="http://en.wikipedia.org/wiki/JavaScript"> + Wikipedia - JavaScript</a> + </li> + <li> + <a href="http://www.adaptivepath.com/publications/essays/archives/000385.php"> + Ajax: A New Approach to Web Applications + </a> + </li> + <li> + <a href="http://en.wikipedia.org/wiki/AJAX"> + Wikipedia - AJAX</a> + </li> + </ul> + + <p> + Another technology that can enhance the HTTP + request/response cycle is SOAP. + Using SOAP, an application can access data and invoke + business logic on another server using HTTP as transfer + layer. + Using AJAX and SOAP together is becoming a popular way for + page to submit finely-grained requests directly to a + remote server, + while still retaining a separation of concerns beween the + the business logic and the page markup,. + </p> + + <p>For more about SOAP, see</p> + + <ul> + <li> + <a href="http://en.wikipedia.org/wiki/SOAP"> + Wikipedia - SOAP</a> + </li> + </ul> + + </subsection> + <a name="java"/> <subsection name="The Java Language and Application Frameworks"> - <p>The framework is written in the popular and versatile + <p> + The framework is written in the popular and versatile <a href="http://java.sun.com/docs/books/jls/first_edition/html/index.html"> Java programming language.</a> Java is an object-orientated language, and the framework @@ -252,7 +321,8 @@ </li> </ul> - <p>Even if you have worked with Java and OOP before, it can + <p> + Even if you have worked with Java and OOP before, it can also help to be aware of the programming challenges specific to creating and using application frameworks. For more about application @@ -274,7 +344,8 @@ </li> </ul> - <p>These papers can be especially helpful if you are + <p> + These papers can be especially helpful if you are fact-finding or reviewing server-side <a href="http://directory.google.com/Top/Computers/Programming/Languages/Java/Server-Side/Libraries_and_Frameworks/"> frameworks</a> @@ -286,7 +357,8 @@ <a name="javabeans"/> <subsection name="JavaBeans"> - <p>Like many Java applications, most of the framework objects + <p> + Like many Java applications, most of the framework objects are designed as <a href="http://java.sun.com/products/javabeans/"> JavaBeans.</a> @@ -295,7 +367,8 @@ developers and by Java development tools. </p> - <p>Although JavaBeans were first created for visual elements, + <p> + Although JavaBeans were first created for visual elements, these object design patterns have been found to be useful as the basis for any reusable component, like those used by the framework.</p> @@ -390,7 +463,8 @@ <a name="resources"/> <subsection name="Properties Files and ResourceBundles"> - <p>Java applications, including web applications, are often + <p> + Java applications, including web applications, are often configured using <a href="http://java.sun.com/j2se/1.4.1/docs/api/java/util/Properties.html"> Properties</a> @@ -436,7 +510,7 @@ </subsection> <a name="servlets"/> - <subsection name="Java Servlets"> + <subsection name="Java Servlets and Web Containers"> <p> Since Java is an object-orientated language, the <a href="http://www.novocode.com/doc/servlet-essentials/"> @@ -602,7 +676,8 @@ <a name="context"/> <subsection name="Servlet Context"> - <p>The + <p> + The <em>ServletContext</em> interface <code>[javax.servlet.ServletContext]</code> @@ -665,7 +740,8 @@ <a name="request"/> <subsection name="Servlet Request"> - <p>Each request processed by a servlet is represented by a + <p> + Each request processed by a servlet is represented by a Java interface, normally a <code>HttpServletRequest</code> @@ -732,7 +808,8 @@ </li> </ul> - <p>In addition, servlet requests support + <p> + In addition, servlet requests support <em>request attributes</em> (from JSP, these are "request scope beans"), analogous to the servlet @@ -745,7 +822,8 @@ the information to produce the corresponding response. </p> - <p>The servlet container guarantees that a particular request + <p> + The servlet container guarantees that a particular request will be processed by a servlet on a single thread. Therefore, you do not @@ -770,7 +848,8 @@ <a name="response"/> <subsection name="Servlet Response"> - <p>The primary purpose of a servlet is to process an incoming + <p> + The primary purpose of a servlet is to process an incoming <a href="#request">Servlet Request</a> <code>[javax.servlet.http.HttpServletRequest]</code> and convert it into a @@ -818,7 +897,8 @@ </li> </ul> - <p>An important principle in using the servlet response APIs + <p> + An important principle in using the servlet response APIs is that any methods you call to manipulate headers or cookies <strong>MUST</strong> @@ -873,7 +953,8 @@ <a name="filter"/> <subsection name="Filtering"> - <p>If you are using a servlet container based on version + <p> + If you are using a servlet container based on version <strong>2.3</strong> or later of the Servlet Specification (such as Tomcat 4.x), you can take advantage of the new Filter APIs @@ -890,7 +971,8 @@ called). </p> - <p>The Struts 1.0, 1.1, and 1.2 versions require only version + <p> + The Struts 1.0, 1.1, and 1.2 versions require only version 2.2 or later of the Servlet Specification to be implemented by your servlet container, @@ -917,7 +999,8 @@ <a name="session"/> <subsection name="Sessions"> - <p>One of the key characteristics of HTTP is that it is + <p> + One of the key characteristics of HTTP is that it is <em>stateless.</em> In other words, there is nothing built in to HTTP that identifies a subsequent request from the same @@ -929,7 +1012,8 @@ several requests to be somewhat difficult. </p> - <p>To alleviate this difficulty, the servlet API provides a + <p> + To alleviate this difficulty, the servlet API provides a programmatic concept called a <em>session,</em> @@ -952,7 +1036,8 @@ (in JSP, they are known as "session scope beans"). </p> - <p>To avoid occupying resources indefinately when a user fails to + <p> + To avoid occupying resources indefinately when a user fails to complete an interaction, sessions have a configurable <em>timeout interval.</em> @@ -1179,7 +1264,8 @@ </li> </ul> - <p>Many times, JSP tags work hand-in-hand with JavaBeans. The + <p> + Many times, JSP tags work hand-in-hand with JavaBeans. The application sends a JavaBean to the JSP, and the JSP tag uses the bean to customize the page for the instant user. For more, see @@ -1188,7 +1274,8 @@ in The J2EE Tutorial. </p> - <p>The framework also works well with the + <p> + The framework also works well with the <a href="http://java.sun.com/products/jsp/jstl"> JavaServer Pages Standard Tag Library </a> @@ -1336,26 +1423,95 @@ application, including a framework application, is <a href="http://securityfilter.sourceforge.net/"> - SecurityFilter</a> - . + SecurityFilter</a> . </p> + </subsection> + + <a name="mvc"/> + <subsection name="Model View Controller (MVC)"> + + <p> + Web applications based on JavaServer Pages sometimes + commingle database code, page design code, and control flow + code. In practice, we find that unless these concerns are + separated, larger applications become difficult to maintain. + </p> + + <p> + One way to separate concerns in a software application is + to use a Model-View-Controller (MVC) architecture. The + Model represents the business or database code, the View + represents the page design code, and the Controller + represents the navigational code. + </p> + + <p> + The term "MVC" originated with the SmallTalk + Model-View-Controller framework. + In Smalltalk MVC, the View updates itself from the Model, via + the "Observer" pattern. The original MVC pattern is like a + closed loop: The View talks to the Controller, which talks to + the Model, which talks to the View. + </p> - <a name="layers"/> - <subsection name="Other layers"> + <p> + But, a direct link between the Model and the View is not + practical for web applications, and we modify the classic MVC + arrangement so that it would look less like a loop and more + like a horseshoe with the controller in the middle. + </p> <p> - The framework provides the control layer for a web - application. + In the MVC/Model 2 design pattern, application flow is mediated + by a central Controller. The Controller delegates requests - + in our case, HTTP requests - to an appropriate handler. The + handlers are tied to a Model, and each handler acts as an + adapter between the request and the Model. The Model + represents, or encapsulates, an application's business logic or + state. Control is usually then forwarded back through the + Controller to the appropriate View. The forwarding can be + determined by consulting a set of mappings, usually loaded from a + database or configuration file. This provides a loose coupling + between the View and Model, which can make applications + significantly easier to create and maintain. + </p> + + <p> + While MVC is a convenient paradigm, many workers find that + applcations may utilize more than three layers. + For example, within the Model, there is often distinct business + logic and data access layers. + </p> + + <p> + The framework provides the control layer for a Model 2 web + applications. Developers can use this layer with other standard - technologies - to provide the business, data access, and presentation - layers. + technologies to build the business, data access, and + presentation layers. </p> - - + + <p> + For more about MVC, see + </p> + + <ul> + <li> + <a href="http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/web-tier/web-tier5.html"> + Web-Tier Application Framework Design</a> (Sun J2EE Blueprints) + </li> + <li> + <a href="http://st-www.cs.uiuc.edu/users/smarch/st-docs/mvc.html"> + Smalltalk MVC framework.</a> + </li> + <li> + <a href="http://en.wikipedia.org/wiki/Model_view_controller"> + Wikipedia - MVC</a> + </li> + </ul> </subsection> - + <a name="logic_frameworks"/> <subsection name="Business Logic Frameworks"> @@ -1421,10 +1577,10 @@ </ul> </subsection> - - + <a name="view_frameworks"/> <subsection name="View Frameworks"> + <p> Aside from Java Server Pages, there are several other presentation technologies available to Java web applications.