Configuration of JSP Development Environment under Windows

zhaozj2021-02-16  91

Sun's JSP (Java Server Pages) is a dynamic web development technology that is executed on server-side, which is based on Java technology. When executing JSP, you need to set up an engine that compiles the JSP web page on the web server. Configuring a JSP environment can have a variety of ways, but main work is to install and configure web servers and JSP engines. Below Tomcat as a JSP engine, with Tomcat, Apache, IIS, three web servers, three ways to build JSP running environments. I. Related software introductions 1, J2SDK: Java2 software development tool is the basis of the Java application. JSP is based on Java technology, so you must install J2SDK before configuring the JSP environment. 2, Apache Server: A common web server developed by Apache organizations, providing web services. 3, Tomcat Server: Apache organization developed a JSP engine that itself has a web server function, which can be used as a stand-alone web server. However, as a web server, Tomcat is not as fast as Apache, nor Apache, but there is no Apache, so we generally use the Tomcat and Apache to provide services to the website's static page request, while Tomcat is a dedicated JSP Engine, providing JSP parsing to get better performance. And Tomcat itself is a sub-project of Apache, so Tomcat provides strong support to Apache. For beginners, Tomcat is a very good choice. 4, MOD_JK.DLL: Apache Organize the Jakarta project group developed the Apache support Tomcat plug-in. With this plugin, Tomcat can seamlessly connect with Apache. 5, TC4NTIS.ZIP: APACHE Organize the Jakarta project group to develop the IIS support Tomcat plug-in. Second, software download 1, J2SDK version: J2SDK1.4.1 (35.9MB) Address: http://java.sun.com/j2se/1.4.1/download.html 2, Apache2.0.43 (6.69MB) Address : Http://www.apache.inetcosmos.org/dist/httpd/binaries/win32/3, Tomcat4 version: 4.1.21 (8.33MB) Address: http://jakarta.apache.org/builds/jakarta-Tomcat -4.0 / release / 4, mod_jk.dll: (136KB) Address: http://jakarta.apache.org/builds/jakarta-tomcat-connectors/jk/release/5, TC4NTIS.ZIP (220KB) Address: http: //Members.ozemail.com.au/~lampante/howto/tomcat/iisnt/tc4ntiis.zip is free of charge. Third, preparation before configuration (1) Prepare a Test JSP page to open a text editor, such as Notepad, enter the following code, and save it to test .jsp (notice extension .jsp).

JSP test page </ title> </ head> <body> <% out.println ("<h1> hello world! </ H1>));%> </ body> < / Html> (2) Installing J2SDK No matter which solution, you must complete the J2SDK installation before installing and configuring the JSP engine. 1. Install J2SDK Under Windows, run the downloaded J2SDK-1_4_1_01-windows-i586.exe file directly, install it to a directory according to the installation wizard, for example, to F: / J2SDK 1.4.1; 2, add environment variables (1) If your operating system is WIN 98, you can use Notepad to edit AutoExec.bat directly, add the following command line:</p> <p>PATH =% path%; f: /j2sdk1.4.1/binset java_home = f: /j2sdk1.4.1set classpath = f: /j2sdk1.4.1/lib/tools.jar</p> <p>After saving, restart your computer so that the environment variable added is valid. (2) If your operating system is Win2000, then configure environment variables as follows. Right-click My Computer, select "Properties" → "System Features" → "Advanced" → Environment Variables in the pop-up menu, and the Environment Variable dialog box can edit the environment variable. Add three variables in Path, Java_Home and ClassPath, and the variable value.</p> <p>Fourth, JSP Environment Configuration Scheme (1) Scheme 1: J2SDK Tomcat In this scheme Tomcat as a JSP engine as a web server, the configuration is relatively simple. 1. Install Tomcat to run the downloaded Jakarta-Tomcat-4.0.1.exe, follow the general Windows program installation steps to install Tomcat, which will automatically look for the J2SDK. For example, install it to F: / Tomcat4. 2. Configuring Tomcat's environment variables Add a new environment variable tomcat_home, the variable value is f: / tomcat4, add the method to the configuration method of the J2SDK environment variable. 3. Test the default service settings, you can run the Tomcat server. Start Tomcat with f: /tomcat4/bin/startup.exe, close with f: /tomcat4/bin/shutdown.exe. (If you prompt the Out of Environment Space error while executing Startup.exe or ShutDown.exe, select "Properties" → "Memory" → "General Memory" in the DoS window, and modify the "Automatic" "2816" can be.) After launching Tomcat, open the browser, enter http: // localhost: 8080 in the address bar (Tomcat default port is 8080), if you see Tomcat's welcome interface, Tomcat works fine. 4, the test project puts the Test.jsp just ready to be in the F: / Tomcat / WebApps / Examples / JSP directory, enter http: // localhost: 8080 / examples / jsp / test.jsp in the address bar, if browse "Hello World!" Is displayed in the server, indicating that your JSP environment is successful! Since Tomcat itself has a web server, we don't have to install Apache, of course it can also be integrated with Apache, hereby. (2) Solution 2: J2SDK Apache Tomcat Although Tomcat can also make a web server, the speed of the static HTML is more than Apache, and its function as a web server is far less than Apache, so the Apache and Tomcat are integrated, and Apache acts as a web Server, while Tomcat is a dedicated JSP engine. The configuration of this solution is more complicated, but it enables Apache and Tomcat to integrate, and achieve powerful functions. Note that because the IIS web server uses the 80 port by default, the Apache's default port is also 80, so if you use the Win2000 operating system, and pre-installed IIS, for convenience, please stop the IIS service before doing the following. 1. Install the Apache running the downloaded apache_2.0.43-win32-x86-no_ssl.exe, install it to F: / Apache2 according to the wizard. (Note that after the installation of Apache2.0.43, the index.html.en under the F: / Apache2 / HTDOCS directory must be renamed to index.html so that the Apache's welcome interface will be displayed normally when testing the default service). 2. After the Apache default service is installed, the Apache server has run automatically.</p> <p>Open the browser, type in the address bar: http: // localhost (Tomcat default port is 80), if you see the welcome interface of Apache in the browser, the Apache is working fine. 3. Install Tomcat as follows, and ensure that it runs normally. 4. Copy the downloaded mod_jk-2.0.42.dll to the F: / Apache2 / Modules directory. 5. Establish the work file required for the MOD_JK module work. Open the text editor, enter the following statement: workers.tomcat_home = f: / tomcat4 (let the mod_jk module know Tomcat) workers.java_home = f: /j2sdk1.4.1 (let the mod_jk module know JSDK) PS = / worker.list = ajp13 MOD_JK module version) worker.ajp13.port = 8009 (MOD_JK work port) worker.ajp13.host = localhost worker.ajp13.type = ajp13 worker.ajp13.lbFactor = 1</p> <p>Save the above statement in the F: / Tomcat4 / Conf directory in workers.properties (Note: The extension of the file is .properties).</p> <p>6. Configure Apache.</p> <p>Open f: /apache2/conf/httpd.conf with text editor</p> <p>1) Find "DirectoryIndex", add index.jsp after index.html.var;</p> <p>2) At the end of httpd.conf, the following paragraph (explained in parentheses)</p> <p>LoadModule JK_Module Modules / MOD_JK-2.0.42.dll</p> <p>(Loading the MOD_JK module, used to handle the connection between Apache and Tomcat)</p> <p>JKWorkersFile "f: /tomcat4/conf/Workers.properties"</p> <p>(Pointing out the position of the work file worker.properties required for the MOD_JK module work)</p> <p>JKMOUNT / Servlet / * ajp13</p> <p>JKMount /*.jsp Ajp13</p> <p>(Send all servlets and JSP requests to Tomcat through the AJP13 protocol, let Tomcat process)</p> <p>3) Save after the addition is completed.</p> <p>7, configure Tomcat</p> <p>Use the text editor to open f: /tomcat4/conf/server.xml. Because Tomcat4 does not enable AJP13 by default, find out the following code:</p> <p><! - <Connector ClassName = "org.apache.ajp.tomcat4.ajp13connector" port = "8009" minprocessors = "5" maxprocessors = "75" acceptcount = "10" debug = "0" /> -></p> <p>Delete the comment symbol <! -> to enable AJP13.</p> <p>Then save, now Tomcat and Apache's integrated configuration is basically completed.</p> <p>8, overall test</p> <p>Put Test.jsp in the F: / Tomcat / WebApps / Examples / JSP directory, start Apache2, Tomcat4 in turn. Open the browser, enter http: // localhost: 8080 / example in the address bar, if "Hello World!" Appears in the browser, then Tomcat is reconfigured, you will work normally; enter HTTP in the address bar : // localhost / examplep, if the result is the same as http: // localhost: 8080 / example / jsp /test.jsp, then the Apache and Tomcat are successful! (3) Solution 3: J2SDK IIS Tomcat</p> <p>The most commonly used web server under the Windows platform is undoubtedly IIS. Under normal circumstances IIS do not support JSP, we can use an IIS to Tomcat to redirect plugins, allow IIS to send all JSP requests to Tomcat, allowing IIS to increase processing JSP function. If you are used to using IIS, you can try this configuration. (If you have already installed the Apache server, please uninstall Apache in order to make it easier.)</p> <p>1. Install Tomcat as follows, and ensure that it runs normally. (For example, install to F: / Tomcat4);</p> <p>2. Download the downloaded TC4NTIS.ZIP directly into the F: / Tomcat4 directory. Check the file required by the configuration, make sure they are in the following locations:</p> <p>f: /tomcat4/server/lib/ajp.jar</p> <p>F: /tomcat4/server/lib/tomcat-util.jar f: /tomcat4/bin/native/isapi_redirect.dll f: /tomcat4/conf/ntiis/workers.properties f: /tomcat4/conf/ntiis/uriworkermap.properties f: /tomcat4/conf/ntiis/iis_redirect.reg</p> <p>f: /tomcat4/log/iis_redirect.log</p> <p>3, open F: /Tomcat4/conf/ntiis/workers.properties with text editor, modify the following value:</p> <p>Workers.tomcat_home = f: / tomcat4</p> <p>Workers.java_home = f: /j2sdk1.4.1</p> <p>4, double-click F: /Tomcat4/conf/ntiis/iis_redirect.reg, add the information within this registration file to the registry, but to modify the key value of the three keys of log_file, worker_file, worker_mount_file, to suit your environment (For example, Tomcat in this article is installed in F: / Tomcat4, not the default C: / Tomcat4). After adding and modified, you will be shown below.</p> <p>5. Open the Internet Service Manager, add a new virtual directory on the default site, named Jakarta, this virtual directory points to F: / Tomcat4 / Bin / Native, and launch the default site.</p> <p>6. Right-click the server name in the Internet Service Manager, select the "WWW Service" → "ISAPI Filter" → "ISAPI Filter" → "ISAPI Filter" → "ISAPI Filter" tab, add an ISAPI filter, name is Jakarta Redirect, the executable is specified as f: /tomcat4/bin/native/isapi_redirector.dll. After adding the ISAPI filter, the status of Jakarta Redirect is a red downward arrow, restarting the IIS service, turning green arrow. 7, edit the server.xml file and save (step 7 of the same second).</p> <p>8, restart IIS and Tomcat.</p> <p>9. Test item: put the test.jsp in the F: / Tomcat / WebApps / Examples / JSP directory. Open the browser, type http: // localhost: 8080 / example in the address bar, if "Hello World!" Appears in the browser, then the Tomcat is reconfigured, and it works fine; enter HTTP in the address bar : // localhost / examplep, if the result is the same as http: // localhost: 8080 / example, the result is the same, that IIS and Tomcat are successful!</p> <p>Five, conclude</p> <p>The operational environment of building JSP is the foundation of learning JSP technology. There are many JSP engines, and there are many configuration methods, and the software version is constantly upgrading. You can choose the appropriate configuration method according to your needs and actual conditions. I hope that there are several JSP environmental configurations given in this article to help people who want to learn JSP.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-10733.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="10733" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.071</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = '7rNmXYUoJ8LuZNQDzI_2BbyXH_2FEtakPh7XlKCE6NZ8RVjU58Kk8zieLcx_2FwFMOSWQaAL14YSPjU9MjuUrHQwyKRA_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>