<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta name="generator" content="pdf2htmlEX">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" href="https://static.pudn.com/base/css/base.min.css">
<link rel="stylesheet" href="https://static.pudn.com/base/css/fancy.min.css">
<link rel="stylesheet" href="https://static.pudn.com/prod/directory_preview_static/6250b98274bc5c0105766fab/raw.css">
<script src="https://static.pudn.com/base/js/compatibility.min.js"></script>
<script src="https://static.pudn.com/base/js/pdf2htmlEX.min.js"></script>
<script>
try{
pdf2htmlEX.defaultViewer = new pdf2htmlEX.Viewer({});
}catch(e){}
</script>
<title></title>
</head>
<body>
<div id="sidebar" style="display: none">
<div id="outline">
</div>
</div>
<div id="pf1" class="pf w0 h0" data-page-no="1"><div class="pc pc1 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/6250b98274bc5c0105766fab/bg1.jpg"><div class="t m0 x1 h2 y1 ff1 fs0 fc0 sc0 ls0 ws0">Working With Web Projects - Qu<span class="_ _0"></span>ickstart</div><div class="t m0 x1 h3 y2 ff2 fs1 fc0 sc0 ls0 ws0">Last Revision: </div><div class="t m0 x1 h4 y3 ff2 fs2 fc0 sc0 ls0 ws0">Outline</div><div class="t m0 x2 h5 y4 ff3 fs1 fc0 sc0 ls0 ws0">1.<span class="_ _1"> </span><span class="ff2 fc1">Preface<span class="_ _2"></span> <span class="_ _3"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x2 h5 y5 ff3 fs1 fc0 sc0 ls0 ws0">2.<span class="_ _1"> </span><span class="ff2 fc1">Introduction<span class="_ _4"></span> <span class="_ _5"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x2 h5 y6 ff3 fs1 fc0 sc0 ls0 ws0">3.<span class="_ _1"> </span><span class="ff2 fc1">Web project concepts and terminology<span class="_ _6"></span> <span class="_ _7"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x2 h5 y7 ff3 fs1 fc0 sc0 ls0 ws0">4.<span class="_ _1"> </span><span class="ff2 fc1">Creating a web project<span class="_ _8"></span> <span class="_ _9"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x2 h5 y8 ff3 fs1 fc0 sc0 ls0 ws0">5.<span class="_ _1"> </span><span class="ff2 fc1">Overview of web development productivity tools<span class="_ _a"></span> <span class="_ _b"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x2 h5 y9 ff3 fs1 fc0 sc0 ls0 ws0">6.<span class="_ _1"> </span><span class="ff2 fc1">Creating a JSP document<span class="_ _c"></span> <span class="_ _d"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x3 h5 ya ff3 fs1 fc0 sc0 ls0 ws0">1.<span class="_ _1"> </span><span class="ff2 fc1">Creating a JSP/a><span class="_ _e"></span> <span class="_ _f"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x3 h5 yb ff3 fs1 fc0 sc0 ls0 ws0">2.<span class="_ _1"> </span><span class="ff2 fc1">Editing JSP<span class="_ _10"></span> <span class="_ _11"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x3 h5 yc ff3 fs1 fc0 sc0 ls0 ws0">3.<span class="_ _1"> </span><span class="ff2 fc1">Using code completion<span class="_ _12"></span> <span class="_ _13"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x3 h5 yd ff3 fs1 fc0 sc0 ls0 ws0">4.<span class="_ _1"> </span><span class="ff2 fc1">Validating JSP<span class="_ _14"></span> <span class="_ _15"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x2 h5 ye ff3 fs1 fc0 sc0 ls0 ws0">7.<span class="_ _1"> </span><span class="ff2 fc1">Deploy, test, and debug web project<span class="_ _16"></span> <span class="_ _17"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x3 h5 yf ff3 fs1 fc0 sc0 ls0 ws0">1.<span class="_ _1"> </span><span class="ff2 fc1">Deploy web project<span class="_ _18"></span> <span class="_ _19"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x3 h5 y10 ff3 fs1 fc0 sc0 ls0 ws0">2.<span class="_ _1"> </span><span class="ff2 fc1">Test application<span class="_ _1a"></span> <span class="_ _1b"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x3 h5 y11 ff3 fs1 fc0 sc0 ls0 ws0">3.<span class="_ _1"> </span><span class="ff2 fc1">JSP debugging<span class="_ _1c"></span> <span class="_ _1d"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x2 h5 y12 ff3 fs1 fc0 sc0 ls0 ws0">8.<span class="_ _1"> </span><span class="ff2 fc1">Working with an existing web project<span class="_ _1e"></span> <span class="_ _1f"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x2 h5 y13 ff3 fs1 fc0 sc0 ls0 ws0">9.<span class="_ _1"> </span><span class="ff2 fc1">Customizing<span class="_ _20"></span> <span class="_ _21"> </span> <span class="_ _22"></span> <span class="_ _22"></span>web project preferences<span class="_ _23"></span> <span class="_ _24"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x2 h5 y14 ff3 fs1 fc0 sc0 ls0 ws0">10.<span class="_ _0"></span><span class="ff2 fc1">Advanced Features<span class="_ _25"></span> <span class="_ _26"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x3 h5 y15 ff3 fs1 fc0 sc0 ls0 ws0">1.<span class="_ _1"> </span><span class="ff2 fc1">Dependent Java project setup and deployment<span class="_ _27"></span> <span class="_ _28"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x3 h5 y16 ff3 fs1 fc0 sc0 ls0 ws0">2.<span class="_ _1"> </span><span class="ff2 fc1">Library deployment policy configuration<span class="_ _29"></span> <span class="_ _2a"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x3 h5 y17 ff3 fs1 fc0 sc0 ls0 ws0">3.<span class="_ _1"> </span><span class="ff2 fc1">Adding Advanced Capabilities... to your Web Project<span class="_ _2b"></span> <span class="_ _2c"> </span><span class="ff3"> <span class="_ _22"></span><span class="ff2"> <span class="_ _22"></span><span class="ff3 fc0"> </span></span></span></span></div><div class="t m0 x2 h5 y18 ff3 fs1 fc0 sc0 ls0 ws0">11.<span class="_ _0"></span><span class="ff2 fc1">Summary<span class="_ _2d"></span> <span class="_ _2e"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x2 h5 y19 ff3 fs1 fc0 sc0 ls0 ws0">12.<span class="_ _0"></span><span class="ff2 fc1">User Feedback<span class="_ _2f"></span> <span class="_ _30"> </span><span class="ff3 fc0"> </span></span></div><div class="t m0 x1 h4 y1a ff2 fs2 fc0 sc0 ls0 ws0">1. Preface</div><div class="t m0 x1 h5 y1b ff3 fs1 fc0 sc0 ls0 ws0">This document was written using Sun JDK 1.4.2, Eclipse 3.1 and MyEclipse 4.0. All screenshots were <span class="_ _0"></span>taken using the default settings for Eclipse, MyEclipse, and Windows XP. If you </div><div class="t m0 x1 h5 y1c ff3 fs1 fc0 sc0 ls0 ws0">experience difficulty with the instruction of this document, please see the <span class="fc1">U<span class="_ _0"></span>ser Feedback</span> section for how to provide feedback to the MyEclipse documentation team.</div><div class="t m0 x1 h3 y1d ff2 fs1 fc1 sc0 ls0 ws0">Back to Top</div><div class="t m0 x1 h4 y1e ff2 fs2 fc0 sc0 ls0 ws0">2. Introduction</div><div class="t m0 x1 h5 y1f ff3 fs1 fc0 sc0 ls0 ws0">This Quick-Start presents the basic and advanced features, concepts, and techniques for rapidly getti<span class="_ _0"></span>ng started in the development of J2EE web applications using MyEclipse Web Tools. </div><div class="t m0 x1 h5 y20 ff3 fs1 fc0 sc0 ls0 ws0">Specifically, this document presents how to:</div><div class="t m0 x2 h5 y21 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Create a MyEclipse Web Project</span></div><div class="t m0 x2 h5 y22 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Create a JSP using the JSP Wizard</span></div><div class="t m0 x2 h5 y23 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Editing a JSP using the JSP Editor</span></div><div class="t m0 x2 h5 y24 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Deploy, test and debug a Web Project as a web application</span></div><div class="t m0 x2 h5 y25 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Add web project capabilities to an existing Java project</span></div><div class="t m0 x2 h5 y26 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Create dependent Java projects and configure their deployment policy</span></div><div class="t m0 x2 h5 y27 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Add an external library to a Web Project and configure its deployment policy</span></div><div class="t m0 x2 h5 y28 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Customize Web Project preferences</span></div><div class="t m0 x1 h3 y29 ff2 fs1 fc1 sc0 ls0 ws0">Back to Top</div><div class="t m0 x1 h4 y2a ff2 fs2 fc0 sc0 ls0 ws0">3. Web Project Concepts <span class="_ _0"></span>and Terminology</div><div class="t m0 x1 h5 y2b ff3 fs1 fc0 sc0 ls0 ws0">This section introduces the key Web Project concepts and terminology used t<span class="_ _0"></span>hroughout the MyEclipse product. Having a basic understanding of these concepts will enable you to work with </div><div class="t m0 x1 h5 y2c ff3 fs1 fc0 sc0 ls0 ws0">MyEclipse Web Projects and productivity tools proficiently and intuitively.</div><div class="t m0 x1 h5 y2d ff3 fs1 fc0 sc0 ls0 ws0">In simplest terms:</div><div class="t m0 x1 h3 y2e ff5 fs1 fc0 sc0 ls0 ws0">A MyEclipse Web Project is an Eclipse Java<span class="_ _0"></span> Project that includes metadata that defines the project's web nature and a directory structure pa<span class="_ _0"></span>tterned after the J2EE web archive<span class="_ _32"></span> </div><div class="t m0 x1 h3 y2f ff5 fs1 fc0 sc0 ls0 ws0">(WAR) structure<span class="ff2"> .</span></div><div class="t m0 x1 h5 y30 ff3 fs1 fc0 sc0 ls0 ws0">Figure 1 presents an annotated view of the structure of an example HelloWorld web project. Not<span class="_ _0"></span>e that MyEclipse web projects are decorated with a small globe icon in the top-right corner of </div><div class="t m0 x1 h5 y31 ff3 fs1 fc0 sc0 ls0 ws0">a project folder, <span class="_ _33"> </span> . Within this example project, two spe<span class="_ _0"></span>cial subfolders are shown: "<span class="ff6">src</span>" and "<span class="ff6">WebRoot</span>" The "<span class="ff6">src</span> " folder contains Java source code such as Java packages and their </div><div class="t m0 x1 h5 y32 ff3 fs1 fc0 sc0 ls0 ws0">classes and interfaces. The<span class="_ _34"></span> <span class="_ _35"> </span> <span class="_ _22"></span> <span class="_ _22"></span>"<span class="_ _36"></span> <span class="_ _37"></span><span class="ff6">WebRoot<span class="_ _38"></span><span class="ff3"> <span class="_ _39"> </span>" folder is the root or<span class="_ _3a"></span> <span class="_ _3b"> </span> <span class="_ _22"></span> <span class="_ _22"></span>base folder of<span class="_ _3c"></span> <span class="_ _3d"> </span> <span class="_ _22"></span> <span class="_ _22"></span>a directory structure patterned after the<span class="_ _3e"></span> <span class="_ _3f"> </span> <span class="_ _22"></span> <span class="_ _22"></span>J2EE web archive (WAR) structure<span class="_ _40"></span> <span class="_ _41"> </span> . The root directory is formally known </span></span></div><div class="t m0 x1 h5 y33 ff3 fs1 fc0 sc0 ls0 ws0">as the <span class="ff2">web-root</span> and it contains 3 subdirectories. Web content and resources such as JSP and HTML files, tag <span class="_ _0"></span>libraries, and JAR files are located under the web-root directory and its </div><div class="t m0 x1 h5 y34 ff3 fs1 fc0 sc0 ls0 ws0">subdirectories. Table-1 defines the role of the web-root subdirectories and resources.</div><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a></div><div class="pi" data-data='{"ctm":[1.045752,0.000000,0.000000,1.045752,0.000000,0.000000]}'></div></div>
</body>
</html>
<div id="pf2" class="pf w0 h0" data-page-no="2"><div class="pc pc2 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/6250b98274bc5c0105766fab/bg2.jpg"><div class="t m0 x1 h6 y35 ff2 fs4 fc0 sc0 ls0 ws0">Figure 1. Example Web Project <span class="_ _0"></span>file structure</div><div class="t m0 x1 h3 y36 ff7 fs1 fc0 sc0 ls0 ws0">Note: While the actual name of the web-root directory and its location within the project a<span class="_ _0"></span>re user definable, its subdirectory structure must include the layout shown in Table 1.</div><div class="t m0 x1 h3 y19 ff2 fs1 fc0 sc0 ls0 ws0">Table 1. Web-root Description</div><div class="t m0 x4 h5 y37 ff3 fs1 fc0 sc0 ls0 ws0">WAR Dir. Layout<span class="_ _42"> </span>WAR Elements<span class="_ _43"> </span>Description</div><div class="t m0 x4 h5 y38 ff3 fs1 fc0 sc0 ls0 ws0"> </div><div class="t m0 x4 h7 y39 ff6 fs1 fc0 sc0 ls0 ws0"><project web-root></div><div class="t m0 x4 h7 y3a ff6 fs1 fc0 sc0 ls0 ws0"> WEB-INF/</div><div class="t m0 x4 h7 y3b ff6 fs1 fc0 sc0 ls0 ws0"> classes/</div><div class="t m0 x4 h7 y3c ff6 fs1 fc0 sc0 ls0 ws0"> lib/</div><div class="t m0 x4 h7 y3d ff6 fs1 fc0 sc0 ls0 ws0"> web.xml</div><div class="t m0 x5 h3 y3e ff2 fs1 fc0 sc0 ls0 ws0">web-root</div><div class="t m0 x6 h5 y38 ff3 fs1 fc0 sc0 ls0 ws0">The root or base directory within a Web Project under wh<span class="_ _0"></span>ich all web content, executable and </div><div class="t m0 x6 h5 y3f ff3 fs1 fc0 sc0 ls0 ws0">support resources resides. Any folder within the project including the project folder itself (see </div><div class="t m0 x6 h5 y3e ff3 fs1 fc0 sc0 ls0 ws0">Figure 2 for an example) that includes the subdirectory structure may serve as the web-root. </div><div class="t m0 x6 h5 y40 ff3 fs1 fc0 sc0 ls0 ws0">Publicly accessible web content such as JSP and HTML files and their organizing </div><div class="t m0 x6 h5 y41 ff3 fs1 fc0 sc0 ls0 ws0">subdirectories typically reside directly under this folder.</div><div class="t m0 x5 h3 y42 ff2 fs1 fc0 sc0 ls0 ws0">WEB-INF/</div><div class="t m0 x6 h5 y43 ff3 fs1 fc0 sc0 ls0 ws0">A direct child directory of the <span class="ff2">web-root</span> directory (e.g., <web-root fol<span class="_ _0"></span>der>/WEB-INF). This </div><div class="t m0 x6 h5 y42 ff3 fs1 fc0 sc0 ls0 ws0">directory and its subdirectories contain the non-public application resources such </div><div class="t m0 x6 h5 y44 ff3 fs1 fc0 sc0 ls0 ws0">as deployment descriptors, tag libraries, compiled java classes, etc.</div><div class="t m0 x5 h3 y45 ff2 fs1 fc0 sc0 ls0 ws0">WEB-INF/classes</div><div class="t m0 x6 h5 y46 ff3 fs1 fc0 sc0 ls0 ws0">A child directory of WEB-INF that serves as the output location of the project's compiled Java </div><div class="t m0 x6 h5 y47 ff3 fs1 fc0 sc0 ls0 ws0">classes from the "<span class="ff6">src</span>" folder(s). Contains *.class files and other non-Java resources from the </div><div class="t m0 x6 h5 y48 ff3 fs1 fc0 sc0 ls0 ws0">source tree. At runtime these resources are accessible from the System classpath.</div><div class="t m0 x5 h5 y49 ff2 fs1 fc0 sc0 ls0 ws0">WEB-INF/lib<span class="_ _44"> </span><span class="ff3">A child directory of WEB-INF that contains the project's JAR files </span></div><div class="t m0 x5 h3 y4a ff2 fs1 fc0 sc0 ls0 ws0">web.xml</div><div class="t m0 x6 h5 y4b ff3 fs1 fc0 sc0 ls0 ws0">The J2EE web deployment descriptor that defines the J2EE web entities such as servlets and </div><div class="t m0 x6 h5 y4c ff3 fs1 fc0 sc0 ls0 ws0">tag libraries. This file is required by J2EE web projects for deployment and execution. The </div><div class="t m0 x6 h5 y4d ff3 fs1 fc0 sc0 ls0 ws0">web.xml file resides in the <web-root>/WEB-INF directory. MyEclipse web tools interpr<span class="_ _0"></span>et and </div><div class="t m0 x6 h5 y4e ff3 fs1 fc0 sc0 ls0 ws0">maintains this file.</div><div class="t m0 x1 h5 y4f ff3 fs1 fc0 sc0 ls0 ws0">Additionally, MyEclipse includes two special project members, the .mymetadata file <span class="_ _0"></span>and the optional .myeclipse folder. The .mymetadata file is an XML formatted file that defines MyEclipse-</div><div class="t m0 x1 h5 y50 ff3 fs1 fc0 sc0 ls0 ws0">specific information such as the location of the web-root folder and other important details r<span class="_ _0"></span>equired by MyEclipse web tools for their proper operation. This file should be treated with equal </div><div class="t m0 x1 h5 y51 ff3 fs1 fc0 sc0 ls0 ws0">importance as the project's corresponding Eclipse .<span class="ff6">project</span> and <span class="ff6">.classpath</span> files. <span class="_ _0"></span>If you are maintaining your project within a source management system, e.g., CVS, i<span class="_ _0"></span>nclude the </div><div class="t m0 x1 h5 y52 ff3 fs1 fc0 sc0 ls0 ws0">.mymetadata file under version control.</div><div class="t m0 x1 h5 y53 ff3 fs1 fc0 sc0 ls0 ws0">The optional <span class="ff6">.myeclipse</span> folder is MyEclipse's transient work area for storing temporary data such as compiled JSPs. <span class="_ _0"></span>Since it is a temporary work area it may be created and deleted </div><div class="t m0 x1 h5 y54 ff3 fs1 fc0 sc0 ls0 ws0">dynamcially by MyEclipse Web Tools. You do <span class="ff7">not</span> need to maintain th<span class="_ _0"></span>is folder under your source code control system. For example, if you are m<span class="_ _0"></span>aintaining your project under CVS we </div><div class="t m0 x1 h5 y55 ff3 fs1 fc0 sc0 ls0 ws0">recommend adding .myeclipse it the project's.cvsignore file. </div><div class="t m0 x1 h5 y56 ff3 fs1 fc0 sc0 ls0 ws0">The default names for the Java source and web-root folders are defined by the Web Project templa<span class="_ _0"></span>te. See <span class="fc1">Section 9</span> to learn more about customizing Web Project preferences. Figure 2, </div><div class="t m0 x1 h5 y57 ff3 fs1 fc0 sc0 ls0 ws0">illustrates a Web Project for which the project folder serves as the web-root folder.</div><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a></div><div class="pi" data-data='{"ctm":[1.045752,0.000000,0.000000,1.045752,0.000000,0.000000]}'></div></div>
<div id="pf3" class="pf w0 h0" data-page-no="3"><div class="pc pc3 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/6250b98274bc5c0105766fab/bg3.jpg"><div class="t m0 x1 h6 y58 ff2 fs4 fc0 sc0 ls0 ws0">Figure 2. Web Project serves a<span class="_ _0"></span>s web-root folder</div><div class="t m0 x1 h3 y59 ff2 fs1 fc1 sc0 ls0 ws0">Back to Top</div><div class="t m0 x1 h4 y5a ff2 fs2 fc0 sc0 ls0 ws0">4. Creating a Web Project</div><div class="t m0 x1 h5 y5b ff3 fs1 fc0 sc0 ls0 ws0">This section introduces the steps for creating an example Web Project named "HelloWorld".</div><div class="t m0 x7 h5 y5c ff3 fs1 fc0 sc0 ls0 ws0">Step-1: Open the new Web Project Wizard by selecting <span class="ff2">File > New > Project > J2EE > <span class="_ _0"></span>Web Project</span> as shown in Figure 3.</div><div class="t m0 x1 h6 y5d ff2 fs4 fc0 sc0 ls0 ws0">Figure 3. Opening web pro<span class="_ _0"></span>ject wizard</div><div class="t m0 x7 h5 y5e ff3 fs1 fc0 sc0 ls0 ws0">Select <span class="ff2">Next ></span></div><div class="t m0 x7 h5 y5f ff3 fs1 fc0 sc0 ls0 ws0">Step-2: Enter <span class="ff7">HelloWorld</span> into the Project Name field.</div><div class="t m0 x1 h5 y60 ff3 fs1 fc0 sc0 ls0 ws0">The remaining fields are prepopulated from the MyEclipse Web Project Template. This tem<span class="_ _0"></span>plate is defined under the MyEclipse J2EE Project preferences and is described in more detail </div><div class="t m0 x1 h5 y61 ff3 fs1 fc0 sc0 ls0 ws0">in <span class="fc1">Section 9</span> . Table-2 <span class="_ _0"></span>describes each of the fields for the New J2EE Web Project wizard shown in Figure 4.</div><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a></div><div class="pi" data-data='{"ctm":[1.045752,0.000000,0.000000,1.045752,0.000000,0.000000]}'></div></div>
<div id="pf4" class="pf w0 h0" data-page-no="4"><div class="pc pc4 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/6250b98274bc5c0105766fab/bg4.jpg"><div class="t m0 x1 h6 y62 ff2 fs4 fc0 sc0 ls0 ws0">Figure 4. Web Project creation detai<span class="_ _0"></span>ls</div><div class="t m0 x1 h5 y63 ff3 fs1 fc0 sc0 ls0 ws0"> </div><div class="t m0 x1 h3 y64 ff2 fs1 fc0 sc0 ls0 ws0">Table 2. New Web Project wizard field defini<span class="_ _0"></span>tions</div><div class="t m0 x4 h3 y65 ff2 fs1 fc0 sc0 ls0 ws0">Field<span class="_ _45"> </span>Description</div><div class="t m0 x4 h5 y66 ff2 fs1 fc0 sc0 ls0 ws0">Project name<span class="_ _46"> </span><span class="ff3">The project's name. Must be a valid Eclipse Java proj<span class="_ _0"></span>ect name. </span></div><div class="t m0 x4 h3 y67 ff2 fs1 fc0 sc0 ls0 ws0">Location</div><div class="t m0 x8 h5 y68 ff3 fs1 fc0 sc0 ls0 ws0">Enable checkbox to specify a custom file-system location for the new </div><div class="t m0 x8 h5 y69 ff3 fs1 fc0 sc0 ls0 ws0">project and its resources.</div><div class="t m0 x4 h3 y6a ff2 fs1 fc0 sc0 ls0 ws0">Directory</div><div class="t m0 x8 h5 y6b ff3 fs1 fc0 sc0 ls0 ws0">The default file-system location for the project is under the workspace </div><div class="t m0 x8 h5 y6c ff3 fs1 fc0 sc0 ls0 ws0">directory for which MyEclipse was started. You may choose an </div><div class="t m0 x8 h5 y6a ff3 fs1 fc0 sc0 ls0 ws0">alternative file location outside of the workspace directory. <span class="ff7">N<span class="_ _0"></span>ote: You<span class="_ _32"></span> </span></div><div class="t m0 x8 h3 y6d ff7 fs1 fc0 sc0 ls0 ws0">may not choose an alternate directory under the workspace directory as<span class="_ _32"></span> </div><div class="t m0 x8 h3 y6e ff7 fs1 fc0 sc0 ls0 ws0">this is not allowed by Eclipse.</div><div class="t m0 x4 h3 y6f ff2 fs1 fc0 sc0 ls0 ws0">Source folder</div><div class="t m0 x8 h5 y70 ff3 fs1 fc0 sc0 ls0 ws0">The Java source folder - will contain Java packages and *.java </div><div class="t m0 x8 h5 y6f ff3 fs1 fc0 sc0 ls0 ws0">files. The contents of this folder are added to the project's Java build </div><div class="t m0 x8 h5 y71 ff3 fs1 fc0 sc0 ls0 ws0">path.</div><div class="t m0 x4 h3 y72 ff2 fs1 fc0 sc0 ls0 ws0">Web root </div><div class="t m0 x4 h3 y73 ff2 fs1 fc0 sc0 ls0 ws0">folder</div><div class="t m0 x8 h5 y74 ff3 fs1 fc0 sc0 ls0 ws0">The folder that will contain the web content, WEB-INF and its required </div><div class="t m0 x8 h5 y75 ff3 fs1 fc0 sc0 ls0 ws0">subfolders. If this field is empty or "/" then the project folder will serve <span class="_ _0"></span>as </div><div class="t m0 x8 h5 y76 ff3 fs1 fc0 sc0 ls0 ws0">the web-root folder.</div><div class="t m0 x4 h3 y77 ff2 fs1 fc0 sc0 ls0 ws0">Context root </div><div class="t m0 x4 h3 y78 ff2 fs1 fc0 sc0 ls0 ws0">URL</div><div class="t m0 x8 h5 y79 ff3 fs1 fc0 sc0 ls0 ws0">This is the context under which the MyEclipse Deployment Serivce will </div><div class="t m0 x8 h5 y7a ff3 fs1 fc0 sc0 ls0 ws0">use when deploying the new Web Project. The default value of the </div><div class="t m0 x8 h5 y7b ff3 fs1 fc0 sc0 ls0 ws0">context-root field is the name of the project. If you are unfamiliar with </div><div class="t m0 x8 h5 y7c ff3 fs1 fc0 sc0 ls0 ws0">the purpose of the context-root, it is the root portion of a URL that is </div><div class="t m0 x8 h5 y7d ff3 fs1 fc0 sc0 ls0 ws0">used to access this application when deployed, e.g., </div><div class="t m0 x8 h5 y7e ff3 fs1 fc2 sc0 ls0 ws0">http://localhost:8080/<span class="_ _25"></span> <span class="_ _26"> </span><span class="fc3">HelloWorld<span class="_ _47"></span><span class="fc2"> <span class="_ _48"> </span><span class="fc0">. You may change the context-root field </span></span></span></div><div class="t m0 x8 h5 y7f ff3 fs1 fc0 sc0 ls0 ws0">to any alpha-numeric value that you prefer.</div><div class="t m0 x4 h3 y80 ff2 fs1 fc0 sc0 ls0 ws0">J2EE </div><div class="t m0 x4 h3 y81 ff2 fs1 fc0 sc0 ls0 ws0">specification </div><div class="t m0 x4 h3 y82 ff2 fs1 fc0 sc0 ls0 ws0">level</div><div class="t m0 x8 h5 y83 ff3 fs1 fc0 sc0 ls0 ws0">Specifies the J2EE specification compliance level. Please ensure that </div><div class="t m0 x8 h5 y84 ff3 fs1 fc0 sc0 ls0 ws0">you select the proper specification level for the J2EE features your </div><div class="t m0 x8 h5 y80 ff3 fs1 fc0 sc0 ls0 ws0">application requires and that your target deployment application </div><div class="t m0 x8 h5 y81 ff3 fs1 fc0 sc0 ls0 ws0">server(s) support this specification level. For example, if you are </div><div class="t m0 x8 h5 y82 ff3 fs1 fc0 sc0 ls0 ws0">working with Tomcat 5.x or JBoss 4.x, choose J2EE 1.4 specification for </div><div class="t m0 x8 h5 y85 ff3 fs1 fc0 sc0 ls0 ws0">the latest J2EE capabilities. Check with your application server vendor </div><div class="t m0 x8 h5 y86 ff3 fs1 fc0 sc0 ls0 ws0">for information regarding J2EE specification level compliance.</div><div class="t m0 x4 h3 y87 ff2 fs1 fc0 sc0 ls0 ws0">Add JSTL 1.0 </div><div class="t m0 x4 h3 y88 ff2 fs1 fc0 sc0 ls0 ws0">libraries</div><div class="t m0 x8 h5 y89 ff3 fs1 fc0 sc0 ls0 ws0">Enabling this option will result in the Java Standard Template Library </div><div class="t m0 x8 h5 y8a ff3 fs1 fc0 sc0 ls0 ws0">(ver. 1.0) JAR's to be added to the new project's <<span class="_ _0"></span>web-root>/WEB-</div><div class="t m0 x8 h5 y8b ff3 fs1 fc0 sc0 ls0 ws0">INF/lib directory. </div><div class="t m0 x1 h5 y8c ff3 fs1 fc0 sc0 ls0 ws0">Step 3: Select <span class="ff2">Finish</span></div><div class="t m0 x1 h5 y8d ff3 fs1 fc0 sc0 ls0 ws0">Completing the wizard creates and configures the H<span class="_ _0"></span>elloWorld Web Project. Figure 5 depicts the structure of the new project from the MyEclipse perspective. To open the MyEclipse </div><div class="t m0 x1 h5 y8e ff3 fs1 fc0 sc0 ls0 ws0">perspective select from the MyEclipse menubar <span class="ff2">Window > Open Perspective > O<span class="_ _0"></span>ther</span> and select . The Java Package Explorer is opened by selecting <span class="ff2">Window > Show View > Java > </span></div><div class="t m0 x1 h5 y8f ff2 fs1 fc0 sc0 ls0 ws0">Package Explorer<span class="ff3">.</span></div><div class="t m0 x1 h5 y90 ff3 fs1 fc0 sc0 ls0 ws0">In Figure 4, note the <span class="ff2">J2EE 1.4 Library Container</span> . <span class="_ _0"></span>This is a library of J2EE API Jars provided by MyEclipse to your project for compilation and code completion support. These API JAR<span class="_ _0"></span> </div><div class="t m0 x1 h5 y91 ff3 fs1 fc0 sc0 ls0 ws0">files are placed only on the project's build path. <span class="ff7">Note: No J2EE JAR files <span class="_ _0"></span>or other resources are physically copied into your project.</span></div><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a></div><div class="pi" data-data='{"ctm":[1.045752,0.000000,0.000000,1.045752,0.000000,0.000000]}'></div></div>
<div id="pf5" class="pf w0 h0" data-page-no="5"><div class="pc pc5 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/6250b98274bc5c0105766fab/bg5.jpg"><div class="t m0 x1 h6 y92 ff2 fs4 fc0 sc0 ls0 ws0">Figure 5. Newly created HelloWorld <span class="_ _0"></span>web project</div><div class="t m0 x1 h5 y93 ff7 fs1 fc0 sc0 ls0 ws0">Congratulations on the creation of a MyEclipse Web Project!!!<span class="ff3"> The next step is to create the proje<span class="_ _0"></span>ct's web content and functionality. <span class="fc1">Section<span class="_ _49"></span> <span class="_ _4a"> </span> <span class="_ _22"></span> <span class="_ _22"></span>5<span class="_ _4b"></span> <span class="fc0"> provides a brief overview of the tools you will </span></span></span></div><div class="t m0 x1 h5 y94 ff3 fs1 fc0 sc0 ls0 ws0">want to be familiar with as you develop your web application. Go to <span class="fc1">Section 6</span> <span class="_ _0"></span>to begin creating web content.</div><div class="t m0 x1 h3 y95 ff2 fs1 fc1 sc0 ls0 ws0">Back to Top</div><div class="t m0 x1 h4 y96 ff2 fs2 fc0 sc0 ls0 ws0">5. Web Development Produ<span class="_ _0"></span>ctivity Tools - Overview</div><div class="t m0 x1 h5 y97 ff3 fs1 fc0 sc0 ls0 ws0">MyEclipse provides a number of productivity tools for the development of web applications. This section outli<span class="_ _0"></span>nes the key tools and their use.</div><div class="t m0 x2 h5 y98 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Editors </span></div><div class="t m0 x3 h5 y99 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">HTML Designer (source, WYSIWYG, preview modes) </span></div><div class="t m0 x3 h5 y9a ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">JSP (source, preview modes) </span></div><div class="t m0 x3 h5 y9b ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">XML, XSL (source, graphical modes) </span></div><div class="t m0 x3 h5 y9c ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">DTD/XSD </span></div><div class="t m0 x3 h5 y9d ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Javascript </span></div><div class="t m0 x3 h5 y9e ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">CSS </span></div><div class="t m0 x3 h5 y9f ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Text </span></div><div class="t m0 x1 h5 ya0 ff3 fs1 fc0 sc0 ls0 ws0">All editors support user customizable syntax color highlighting, font, layout and formatting. The <span class="_ _0"></span>HTML, JSP, and XML editors provide real-time validation and error marking similar to the </div><div class="t m0 x1 h5 ya1 ff3 fs1 fc0 sc0 ls0 ws0">Eclipse Java editor.</div><div class="t m0 x2 h5 ya2 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Wizards </span></div><div class="t m0 x3 h5 ya3 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Web Project creation </span></div><div class="t m0 x3 h5 ya4 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">HTML creation </span></div><div class="t m0 x3 h5 ya5 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">JSP creation includes Struts </span></div><div class="t m0 x3 h5 ya6 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">web.xml document creation and maintenance </span></div><div class="t m0 x3 h5 ya7 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">XML creation </span></div><div class="t m0 x2 h5 ya8 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Validation </span></div><div class="t m0 x3 h5 ya9 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">JSP including custom tags, and Java scriptlets </span></div><div class="t m0 x3 h5 yaa ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">HTML </span></div><div class="t m0 x3 h5 yab ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">CSS </span></div><div class="t m0 x3 h5 yac ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">XML/XSL </span></div><div class="t m0 x3 h5 yad ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Deployment descriptors </span></div><div class="t m0 x2 h5 yae ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Deploy, Test, and Debug </span></div><div class="t m0 x3 h5 yaf ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Deploy directly from MyEclipse to test application server environment </span></div><div class="t m0 x3 h5 yb0 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Support for over 20 different application servers </span></div><div class="t m0 x3 h5 yb1 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Launch and control an application server</span></div><div class="t m0 x3 h5 yb2 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Hot-swap/update debugging of JSP and Java code </span></div><div class="t m0 x2 h5 yb3 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Advanced Capabilities </span></div><div class="t m0 x3 h5 yb4 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Struts Designer and Wizards </span></div><div class="t m0 x3 h5 yb5 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">XDoclet support </span></div><div class="t m0 x3 h5 yb6 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Java Server Faces support </span></div><div class="t m0 x3 h5 yb7 ff4 fs3 fc0 sc0 ls0 ws0">•<span class="_ _31"> </span><span class="ff3 fs1">Hibernate support </span></div><div class="t m0 x1 h3 yb8 ff2 fs1 fc1 sc0 ls0 ws0">Back to Top</div><div class="t m0 x1 h4 yb9 ff2 fs2 fc0 sc0 ls0 ws0">6. Developing JSP Resou<span class="_ _0"></span>rces</div><div class="t m0 x1 h5 yba ff3 fs1 fc0 sc0 ls0 ws0">This section introduces the process for creating a simple helloworld.jsp JSP file <span class="_ _0"></span>using the MyEclipse wizards and JSP Editor. We will continue working with the HelloWorld Web Project </div><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a></div><div class="pi" data-data='{"ctm":[1.045752,0.000000,0.000000,1.045752,0.000000,0.000000]}'></div></div>