Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 27 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
27
Dung lượng
323,44 KB
Nội dung
[...]... a Struts based Web application The Struts Implementation of the MVC The Struts Framework models its server−side implementation of the MVC using a combination of JSPs, custom JSP tags, and Java servlets In this section, we briefly describe how the Struts Framework maps to each component of the MVC When we have completed this discussion, we will have drawn a portrait similar to Figure 1. 1 Figure 1. 1:... drawn a portrait similar to Figure 1. 1 Figure 1. 1: The Struts implementation of the MVC Figure 1. 1 depicts the route that most Struts application requests follow This process can be broken down into five basic steps Following these steps is a description of the ActionServlet and Action classes 1 A request is made from a previously displayed View 4 The Struts Implementation of the MVC 2 The request is received... and provide a loose coupling to the Controller of a Struts application We build a working Struts View in Chapter 3; and in Chapter 5, “The Views,” we examine the Struts Views in more detail The Controller The Controller component of the Struts Framework is the backbone of all Struts Web applications It is implemented using a servlet named org.apache .struts. action.ActionServlet This servlet receives all... started with the installation and configuration of Tomcat, you need to make sure you have acquired the items listed in Table 1. 3 Table 1. 3: Tomcat Installation Requirements Component Jakarta Tomcat 4 JDK 1. 3 Standard Edition Location http:/ /jakarta. apache.org/ http://java.sun.com/j2se /1. 3/ Installing and Configuring Tomcat For our purposes, we will install Tomcat as a stand−alone server on a Windows NT/2000... Figure 1. 5 9 Testing Your Tomcat Installation Figure 1. 5: The default Tomcat home page The next step is to verify the installation of our JDK The best way to do this is to execute one of the JSP examples provided with the Tomcat server To execute a sample JSP, start from the default Tomcat home page, shown in Figure 1. 5, and choose JSP Examples You should see a page similar to Figure 1. 6 Figure 1. 6:... location of your JDK installation Figure 1. 4 shows the settings associated with our installation Figure 1. 4: The JAVA_HOME environment settings for our installation 5 Your final step should be to repeat Step 4, using CATALINA_HOME for the variable name and the location of your Tomcat installation as the value For my installation, I set the value to D:\ jakarta tomcat−4.0 .1 That’s all there is to it You can... The Struts Framework does not provide any specialized Model components; therefore, we will not dedicate an entire chapter to the Model component Instead, we will reference Model components as they fit into each example The View Each View component in the Struts Framework is mapped to a single JSP that can contain any combination of Struts custom tags The following code snippet contains a sample Struts. .. choose the JSP example Snoop and click the Execute link If everything was installed properly, you should see a page similar to the one shown in Figure 1. 7 10 Summary Figure 1. 7: : The results of the Snoop JSP execution If you do not see the page shown in Figure 1. 6, make sure that the location of your JAVA_HOME environment variable matches the location of your JDK installation Summary Our next chapter is... type mappings • Welcome file list • Error pages • Security information Figure 1. 2: The wileyapp Web application hosted by Tomcat This code snippet contains a sample deployment descriptor that defines a single servlet We examine the web.xml file in much more detail later in this text . Application 11 4 Debugging a Struts Application 12 0 Setting Up the Debug Environment 12 1 Debugging the wileystruts Application 12 4 Summary 12 5 ii Table of Contents Chapter 11 : Developing a Complete Struts. DataSource in Your Struts Application 10 7 Creating a Sample Database 10 8 Using a DataSource in a Struts Application 10 9 Summary 11 3 Chapter 10 : Debugging Struts Applications 11 4 Embedding Tomcat. Subelement 17 9 Adding a Struts DataSource 17 9 Adding FormBean Definitions 18 1 Adding Global Forwards 18 2 Adding Actions 18 2 Adding a RequestProcessor 18 4 Adding Message Resources 18 5 Adding a Plug−in 18 6 Chapter