1. Get JBOSS
Download JBOSS, http://www.jboss.org, you can go to his download center to download; another website is Ghost.
1.1 obtain and install JDK
JDK is obtained at http://java.sun.com/. the latest JDK version is 1.4.1. Download, install and configure JDK this part please see "TOMCAT installation and configuration" have a detailed introduction, please go to the western electronic http://www.weste.net site to find ).
1.2 install JBOSS
JBOSS installation is very simple. After you download the JBOSS compressed package, you only need to decompress it. The following directories are generated:
Bin: the executable script file for jboss start and stop. Example of placing jboss in docs, test script, and DTD of various script configuration files. Lib to place some jar package files required by jboss. The jar package required by the client to place the EJB client for running. The server places the files required for configuring the server-side EJB of various startup types.
1.3 start and close the JBOSS Service
Go to the bin directory and run the run. bat file to start the JBOSS service. If you run the program hudown. bat, you can end the JBOSS service. To close the JBOSS service, you only need to enter the shutdown-S command. Note: S is in upper case ).
1.4 check whether JBOSS is successfully started
Open http: // localhost: 8080/jmx-console/address, and you can see the JMX Agent View, which contains various parameters and lists, and open http: // localhost: 8083/is a blank page, indicating that you have installed and started successfully.
2. Release JSP programs
2.1 compile jsp programs
First, write a simple index. jsp program. The Code is as follows:
- < html>
- < head>
- < title>hello< /title>
- < /head>< body>
- < %
- out.print("hello world!");
- %>
- < /body>
- < /html>
2.2 create a. war file.
You may not understand the relationships between jar, war, and ear files.
JAR: Java Archive
WAR: Web Archive
EAR: Enterprise Archive
JDK uses the jartool to store a jar.exe application in the bindirectory of the Java Development Directory. The usage is as follows:
Usage:
Jar {ctxu} [vfm0M] [jar-file] [manifest-file] [-C Directory] File Name...
Option: -c create a new archive-t list the archive content list-x expand the named or all files in the archive-u update the existing archive-v generate detailed output to the standard output -f specifies the archive file name.-m contains the marked information from the marked file.-0 is used for storage only; without ZIP compression format-M does not generate a list of all items manifest] File-I generates index information for the specified jar file-C changes to the specified directory and contains the following files: if a file name is a directory, it is recursively processed.
List manifest 〕
Both the file name and the archive file name must be specified, in the same order specified by the "m" and "f" signs.
Example 1: Archive two class files to an archive file named "classes. jar:
Jar cvf classes. jar Foo. class Bar. class
Example 2: use an existing manifest file "mymanifest" to archive all files in the foo/directory to an archive file named "classes. jar:
Jar cvfm classes. jar mymanifest-C foo /.
Single file Packaging
My index. jsp file is temporarily stored in D: \ ejb, so the packaging command is as follows:
D: \ ejb> jar cvf hello. war index. jsp
Multi-file Packaging
Note the path of the relevant file
For example, first create a hello directory. For the directory structure, see the project file under the webapps directory under tomcat.
Webapps \ hello \
\ Sourcefile. jsp
WEB-INF
Web. xml
\ Lib
*. Jar
\ Class
*. Class
To create a. war file, run the following command:
D: \ ejb \ hello> jar cvf hello. war *.*
Here I have generated the hello. war file.
2.3 release war
Generally, it is easy to publish a war. just copy the hello. war file to the % jboss_home % \ server \ default \ deploy \ directory.
2.4 war
Open your browser and enter the URL: http: // localhost: 8080/hello.
- How to resolve conflicts between JBoss and log4j
- Install and configure JBoss in Windows
- JBoss cluster configuration overview and cluster knowledge
- JBoss download and JBoss Installation
- Deploy a JBoss-based J2EE Application