First you have to configure your environment.
Configure the Tomcat Environment 1, to my machine (IP 192.1.168.7, the user is GUEST, the password is not), copy J2SDK-1_4_2_02-Windows-I586-P.exe, Jakarta-Tomcat-5.0. 14.zip, Jakarta-struts-1.1.zip three press. 2, first double click J2SDK-1_4_2_02-windows-i586-p.exe installation JDK, it is best to install it into an root directory. It is assumed here to be installed under D: /J2SDK1.4.2_02. 3, install Tomcat. Tomcat does not need to be installed, just extract JAKARTA-TOMCAT-5.0.14.zip to the hard disk with it. Suppose it is decompressed to D: / Tomcat. 4, configure environment variables. Right click on the "My Computer" icon, select "Advanced" child, click the "Environment Variable" button. In "System Variable", the following environment variables are new: Name key value Description Java_Home D: /J2SDK1.4.2_02 is your JDK installation directory classpath.;% Java_home% / lib5, unzip jakarta-struts-1.1.zip to Any directory, copy the Struts-Example.war file under /jakarta-struts-1.1/webapp directory to Tomcat / Tomcat / WebApps 6, enter the / tomcat / bin directory, click Startup.bat to start Tomcat. (Click Shutdown.bat after tomcat) 7, let Tomcat run in the background, open IE, enter http: // localhost: 8080 / can enter the home page of Tomcat in the address bar, enter http: // localhost: 8080 / Struts-Example can enter an example of Struts.
I wish you all a successful installation :)
Then let's take a look at the two most important files in the struts example, both of which are configuration files.
Struts-config.xml (I have noticed the situation of specific configuration)
Xml Version = "1.0" encoding = "ISO-8859-1"?>
Requirements for .do in. DO are processed here. Here is equivalent to the Struts's Model section, the Model section is a flexible place in Struts. ->
Web.xml (I have noticed the situation of specific configuration)
web-app>
These two files are the basic configuration of our JDK Tomcat Struts, pay attention: You need to restart Tomcat after changing this configuration!
Save your .jsp file in / your directory /, their write you can write with HTML or FrongPage and other tools. For everyone, it is relatively simple, I will no longer have a book, the code is as follows: index.jsp
<% @ Page ContentType = "Text / HTML; Charset = GB2312"%> <% @ page import = "java.util. *, java.sql. *, java.text. *, java.io. *"%>