Deploy JSP + JavaBean web application on tomcat6.0

Source: Internet
Author: User

 

1.
First, write the JavaBean program. Assume that the class name is num. numberguess. The file name is num. java.

2.
Then write the JSP code. Assume that the source file is named index. jsp.

3.
In the tomcat installation directory, create a new directory with a casual name. Assume It is MyApp.

4.
Create two directories in MyApp: WEB-INF and meta-INF. Copy index. jsp to the directory.

5.
Create a web. xml file in the WEB-INF. The content is as follows:

<? XML version = "1.0" encoding = "UTF-8"?> <Br/> <web-app version = "2.5" xmlns = "http://java.sun.com/xml/ns/javaee" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: schemalocation = "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <br/> <session-config> <br/> <session-Timeout> <br/> 30 <br/> </session-Timeout> <br/> </session-config> <br/> <welcome-file-List> <br/> <welcome-File> index. JSP </welcome-File> <br/> </welcome-file-List> <br/> </Web-app> 

6.
Copy num. Java to WEB-INF/classes/num. Java

7.
Create context. XML in META-INF with the following content:

<? XML version = "1.0" encoding = "UTF-8"?> <Br/> <context antijarlocking = "true" Path = "/num"/> 

Start Tomcat. Open your browser and enter http: // localhost: 8080/MyApp/num/index. jsp in the address bar. You can access the application you just released.

 

Related Article

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.