Flowchart for Developing JSPs

You will be following the steps listed in the flowchart shown in Figure 5.3 for developing your sample JSP applications throughout today and tomorrow (Day 6, "Advanced JavaServer Pages Techniques").

Figure 5.3. Flowchart for developing JavaServer Pages.

graphics/05fig03.gif

In step 1, you define the requirements for your sample application. This is essentially the problem statement for developing the Web application using JSP.

In step 2, you design the static and dynamic behavior of the JSP. The static design will consist of the class diagram and the package diagram for the JSP. The dynamic behavior will be modeled by the sequence diagram. Since you will be implementing the BookShoppingServlet in JSP, there will not be many changes to class design or the sequence diagram apart from the class names being different.

In step 3, you set up the deployment environment for the JSP. JSPs, like servlets, are Web applications, and hence they will be deployed in the applications directory as a separate Web application. The actual components of the Web application, including the JSPs, compiled classes, static HTML files, images, and so on, will be kept in the WEB-INF directory. In addition, you need to have the environment consisting of the PATH and CLASSPATH variables set up for the MS-DOS prompt, where you perform the next step.

In step 4, you create the Web archive file, which contains all the components of this servlet application, including the servlet classes, static HTML pages, and images. The Web archive file is essentially a Java archive file renamed with the .war extension. The final stage of deployment for the servlet application is copying this .war file in the target deployment directory, which is the applications directory in your WebLogic instance domain.

One thing that you should note in the flowchart is that no explicit compiling is performed by the developer. So who does the compiling of the JSP into the servlet class? It is the JSP engine within the WebLogic Server that performs the compilation. Because all JSPs have the extension .jsp, on receiving a request from the browser for a file with .jsp extension, the Web server within the WebLogic Server does not process the request but delegates it to the JSP engine. The JSP engine invokes the JSP servlet code generator first. The entire JSP is parsed and converted into a servlet .java file. This .java file has an embedded service() method, which contains the Java code, as well as the HTML code. The compiler in the JSP engine compiles the JSP into a servlet class. The compiled servlet class is automatically loaded by the WebLogic Server, and the init() method and the service() method are called respectively.

Any errors found during parsing or compiling are displayed directly in the browser by the WebLogic Server. Debugging JSPs, as you will soon experience, is not a pleasant task. You will be studying the different techniques of debugging on Day 17, "Debugging Applications."



Sams Teach Yourself BEA WebLogic Server 7. 0 in 21 Days
Sams Teach Yourself BEA WebLogic Server 7.0 in 21 Days
ISBN: 0672324334
EAN: 2147483647
Year: 2002
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net