websphere--Deploying Servlets

Source: Internet
Author: User
Tags websphere application server

Deploying a servlet on a WebSphere application server requires four steps: compiling the servlet or WEB application, placing the class file on the WebSphere application server, and the associated HTML, JSP, and SHTML File on the WebSphere Application server, configure the initialization parameters with the manager of the WebSphere application server, and set other options.
    • 1. Compiling Servlets and WEB applications
Compile the Servlet with the following considerations:
(1) Ensure that the system CLASSPATH environment variable includes the JDK Classes.zip file and the corresponding WebSphere application server JAR file. There are several WebSphere Application server JAR files in the Lib directory. Depending on the classes you need to import, you might also want to include the JAR files that are not listed in the example:
If you are using Windows NT, enter the following command separately (on the same line):
Set classpath=.; Java_home\lib\classes.zip;
Applicationserver_root\lib\ibmwebas.jar;
Applicationserver_root\lib\jst.jar;applicationserver_root\lib\jsdk.jar;
Applicationserver_root\lib\xml4j.jar;
applicationserver_root\lib\databeans.jar;%classpath%
(2) Set the PATH environment variable to include the variable of the Java/bin directory with the following command:
For Windows NT, the command is: set path=java_home\bin;%path%
(3) test if the corresponding Java development Kit (JDK) is in the path by issuing the following command:
Java-version
The command should return the status message for the JDK version.
(4) Compile the Servlet by issuing the following command
Javac Filename.java
    • 2. Placing the class file on the WebSphere application server
By default, the WebSphere application server looks for the servlet class file under the servlet root directory applicationserver_root\servlets. Copy the compiled Servlet class file to the directory. To mount a servlet from an alternate servlet directory, configure the reconfigurable servlet directory. To mount a servlet from a remote system, specify the remote system when you configure the servlet with the manager of the WebSphere application server.
(1) If the servlet is in a package, the package structure is mirrored into a servlet\ or a subdirectory under the servlet directory that can be re-installed. For example, if the servlet Signonservlet.class and Accountbean.class are in a package named WebBank, place the servlet under directory Servlet\webbank.
(2) If the servlet imports a non-Servlet class that you have developed, it is recommended that those classes be copied to applicationserver_root\servlets.
Depending on the settings in the Jvm.properties file, all Servlet standard outputs will be determined to the Applicationserver_root\logs\ncf.log file or to the Java console window. See the instructions for enabling the Java console.
3. Placing HTML, JSP, and SHMTL files on the WebSphere application server
Copy the HTML, JSP, and SHMTL files associated with the servlet to the WEB server's HTML document root directory server_root\html_directory. This directory is determined by the specific server configuration (delivery, alias, and settings of the virtual host rule).
4. Configuring the Servlet
To mount a servlet from a JAR or SER file on a remote system, or to set initialization parameters, use the WebSphere Application server's manager to configure the servlet or use an XML servlet configuration.

websphere--Deploying Servlets

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.