Tomcat novice Raiders

zhaozj2021-02-16  68

1. Download the necessary software 1JDK 1.4.22222222.02, Configuring Environment Windows System User: My Computer ------> Right button -------> Properties -------> Details ---- ---> Environment Variable Add: java_home = x: /jdk1.4.2 classpath =% java_home% / lib;.; (This can not, but plus harmless)

Modify PATH = x: /jdk1.4.2/bin

Add Catalina_Home = x: / tomcat (here is Tomcat_Home = X: / Tomcat) Note: Here X is the installed drive.

Here is how to set up the Startup.bat file in the bin directory. We can open Startup.bat in the editing state, see that this file needs to read the system variable, we set the one. For example, the current STARTUP.BAT file content of my version Tomcat is as follows: @echo offif "% os%" == "Windows_NT" setLocalRem ---------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- --- Rem Start Script for the Catalina ServerRemreme $ ID: Startup.bat, V 1.4 2002/01/15 02:55:38 Patrickl Exp $ REM ----------------- -------------------------------------------------- ------------

rem Guess CATALINA_HOME if not definedif not "% CATALINA_HOME%" == "" goto gotHomeset CATALINA_HOME = .if exist "% CATALINA_HOME% / bin / catalina.bat" goto okHomeset CATALINA_HOME = ..: gotHomeif exist "% CATALINA_HOME% / bin / Catalina.bat "goto okhomeecho the catalina_home environment variable is not defined CorrectLyecho this Environment variable is needed to run this programgoto end: okhome

SET EXECUTABLE =% Catalina_Home% / BIN / CATALINA.BAT

Rem Check Target Executable EXISTSIF EXIST "% Executable%" Goto OKExececho Cannot Find% Executable% Echo this File Is Needed to Run this ProgramGoto end: OKEXEC

Rem get remaining unshifted Command Line Arguments and Save The IN THESET CMD_LINE_ARGS =: setargsif "% 1" == "" "Goto Donesetargsset cmd_line_args =% cmd_line_args %% 1shiftgoto setargs: donesetargs

Call "% executable%" start% cmd_line_args%: END

We can clearly see that this file needs to read the value of the system variable Catalina_home, so we can set the Catalina_home to Tomcat in the environment variable.

3, start, close Tomcat has 2 methods can be started, close the installed Tomcat: 1 Direct click Run BIN directory STARTUP.BAT and shutdown.bat files. 2 Since we set the path before, we directly type Startup or shutdown directly in the DOS window.

4, set the virtual directory editing server file (x: /tomcat/conf/server.xml) Because you want to read the information of the Server file when Tomcat is started, you must restart Tomcat after changing the Server file.

For example: We intend to establish a Myjsp's virtual directory, just add the following code to the server.xml file:

Reloadable = "true" crossText = "true">

Among them, Path is the virtual directory we have to build, and DOCBASE is the location of the actual directory on the hard disk.

5. Try the results of our previous work to edit a simple small example to test whether our virtual directory is available. Refresh.jsp (c: /myjsp/refresh.jsp)

<% @ page language = "java"%> <% @ page import = "java.util.date"%> <% response.setHeader ("refresh", "5");%>

Auto Refresh EXAMPLE

Refresh Time: 5 Sencords

Now Time Is: <% = new date ()%>

转载请注明原文地址:https://www.9cbs.com/read-16313.html

New Post(0)