# Index.jsp Sample

This topic inludes the source code for the Index.jsp Sample.

## Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebApp/handlingData/traditional_vs_pageFlow_webApp/

## Sample Source Code

`01 <%@ page language="java" contentType="text/html;charset=UTF-8"%> 02 <%@ taglib uri="netui-tags-databinding.tld" prefix="netui-data"%> 03 <%@ taglib uri="netui-tags-html.tld" prefix="netui"%> 04 <%@ taglib uri="netui-tags-template.tld" prefix="netui-template"%> 05 <netui:html> 06 <head> 07 <title> 08 index.jsp 09 </title> 10 <link href="/WebApp/resources/css/style.css" type="text/css" rel="stylesheet"/> 11 </head> 12 <body> 13 <jsp:include page="/resources/jsp/header.jsp"/> 14 <blockquote> 15 <h1>Traditional JSP Applications Vs. Page Flow Applications</h1> 16 <h2>Introduction</h2> 17 <p>This sample shows the differences between traditional JSP web applications 18 and Page Flow web applications. 19 <p>Two web applications are provided. To an end user, the applications appear 20 identical. Both applications call a web service, MazeGenerator.jws, 21 and display a maze to the user based on the results returned from the web service. 22 <p>The difference between these web applications is in the way that they 23 process user requests. The traditional JSP version of the application processes 24 user requests within the JSP pages, but the Page Flow version processes user 25 requests in a separate Controller file. This makes the Page Flow version of the 26 application much easier to build, edit and maintain. 27 <h2>Contents</h2> 28 <blockquote> 29 <p>Traditional JSP Version</p> 30 <blockquote> 31 <b><code>errorpage.jsp</code></b>: This JSP error page is invoked whenever exceptions are 32 encountered on the main JSP page.<br> 33 <b><code>mazeDisplay.jsp</code></b>: This is the main JSP page. It has four jobs. 34 It (1) receives user requests, (2) invokes the web service, 35 (3) converts the results to a graphical display and (4) displays the results to the user.<br> 36 <b><code>specifyMaze.html</code></b>: This HTML page collects requests from the user and 37 submits them to <code>mazeDisplay.jsp</code> which processes the request and diplays 38 the results. 39 </blockquote> 40 </blockquote> 41 <blockquote> 42 <p>Page Flow Version</p> 43 <blockquote> 44 <b><code>errorpage.jsp</code></b>: This JSP error page is invoked whenever exceptions are 45 encountered in the Controller file <code>mazeController.jpf</code>.<br> 46 <b><code>mazeController.jpf</code></b>: This is the main data processing page. It has three 47 jobs. It (1) receives user requests, (2) invokes the web service, and (3) converts the 48 results to a graphical display. 49 <b><code>mazeDisplay.jsp</code></b>: This is the main JSP page. It has one job. It 50 displays the results to the user.<br> 51 <b><code>specifyMaze.jsp</code></b>: This JSP page collects requests from the user and 52 submits them to the Controller file <code>mazeController.jpf</code> 53 which processes the request and forwards the results to the display page 54 <code>mazeDisplay.jsp</code>. 55 </blockquote> 56 </blockquote> 57 <p>It is especially instructive to compare the two JSP pages named "mazeDisplay.jsp" in the two versions 58 of the application. Notice how the little code is contained in the Page Flow version compared 59 to the traditional version. 60 61 <h2>Instructions</h2> 62 <ol> 63 <li>Run either the <a href="/WebApp/handlingData/traditional_vs_pageFlow_webApp/traditional_webApp/specifyMaze.html"> 64 traditional JSP application</a> or the 65 <netui:anchor action="toPageFlow">Page Flow application</netui:anchor>. 66 <li>Enter integers for rows and columns and click Submit.</li> 67 </ol> 68 <p>If you invoke &quot;Display Text Maze&quot;, you will see a text 69 representation of the maze that was returned from the web service. 70 <p>If you invoke &quot;Display Graphical Maze&quot;, you will see a graphical 71 maze with a stone textured background and black walls.</p> 72 73 74 <h2>Proxy Classes</h2> 75 <p>Both of these web application access the web service through its 76 proxy client classes. These proxy client classes are used as an alternative to 77 a web service control. 78 <p>The web service, MazeGenerator.jws, is available in the SamplesApp 79 application at <code>SamplesApp/WebServices/proxy/mazegen/</code>. 80 This web service was used to generate the proxy classes called by the 81 web applications. The web service 82 exposes two operations. Each accepts two integers as parameters representing the 83 desired number of rows and columns in a randomly generated maze. getRandomMaze 84 returns the maze as an array of integers that encode the walls present in each 85 cell of the maze. printRandomMaze returns a &quot;text graphics&quot; 86 representation of the maze.</p> 87 <p>The proxy for any given Workshop web service is 88 available from that service's Test 89 View on the Overview Page. The proxy comes as a web service-specific JAR file 90 containing proxy classes. To use the proxy, you also need the generic 91 webserviceclient.jar that is also available from Test View.</p> 92 <hr> 93 </blockquote> 94 <p><netui:anchor href="/WebApp/handlingData/handlingDataController.jpf">Return to Web Application Samples: Handling Data</netui:anchor> 95 <p><netui:anchor href="/WebApp/Controller.jpf">Return to Web Application Samples Home</netui:anchor> 96 </body> 97 </netui:html>`