Purely handmade (not using the IDE) Java Web project

Source: Internet
Author: User

Required environment

1. Compiler: JDK

2. Web server: Tomcat

3, Text editor: Sublime, write Java files and JSP files, no words with Notepad also line.

First, establish the structure of the project directory, such as

Can be completed under the operating system, such as the above structure in the D packing directory

Second, in the "Src/com/zyz" directory to establish model class file

Dog.java

 Package Com.zyz;  Public class Dog  {    private  String name;      Public String GetName () {        returnthis. Name;    }      Public void setName (String name) {        this. name=name;    }    } 

Third, compile "Dog.java" and output to "Web-inf/classes/com/zyz"

Press "Win+r" to enter "CMD" into the DOS window, enter

D:

CD Shop

Javac src\com\zyz\dog.java-d web-inf\classes

Iv. Create a JSP file under the project root directory, such as "index.jsp"
<%@ Page Language="Java"pageencoding="Utf-8" %><%@ Page Import="Com.zyz.Dog" %><!DOCTYPE HTML><HTMLLang= "en"><Head>    <MetaCharSet= "UTF-8"/>    <title>Dog Shop</title></Head><Body>    <H1>        <%Dog D=NewDog (); D.setname ("Huahua");        Out.println (D.getname ()); %>    </H1></Body></HTML>

The project is completed and the directory structure is as follows:

Copy the project root "shop" into Tomcat's WebApps directory.

You can delete the SRC directory and post the following directory:

Vi. launch Tomcat and enter "Http://localhost:8080/shop/index.jsp" in the browser

Purely handmade (not using the IDE) Java Web project

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.