JavaWeb small project (1)

To sum up some time ago, after learning JSP , Servlet , JavaBean , with Tomcat server and MySQl database to build the first simple website.

Before and after, after learning the concepts and knowledge mentioned above, I am further familiar with the entire construction process, the configuration of the environment, and the deployment of the project.

Before I forget it, I feel like doing a wave of summarization.

Tools used: Tomcat (version number: 8.5.29 )

IDEA (as an IDE tool for developing web projects )

MySql (database) +mysql driver package (version number: mysql-connector-java-5.1.46-bin.jar )

Since learning JavaWeb is still in the introductory stage, no framework is used.

Preparation steps:

 Since the web project is built , many Java source files need to be compiled using the classes in the servlet-api.jar package.

  

This class is not available in JDK , so in order to compile successfully, you need to import this jar package. This package is available in Tomcat 's lib path, and you need to download it specially. If you are building a web project on Tomcat in the original ecology , you need to configure various CLASSPATH environment variables in the step of compiling the files, and use the most primitive javac command to achieve compilation (so the youngsters hurry up to the next IDE , get out of the bitter sea as soon as possible ).

In order to successfully connect to the database, you also need to download the driver package of the database you are using. I am using MySql , and the details of the driver package are written above. Put the driver package into the lib folder in your WEB-INF directory . Before that, you need to create WEB-INF in the web folder of your web project in advance , and then continue to create the classes folder (this folder It is used to store the compiled class files of the Java source files at that time ) and lib files.

  

After creating the file, be sure to remember to set the path of Paths under Project Structure . Only set the path here to the classes folder you just created, and when the compilation is completed in the future, the class files will be automatically placed here.

 

At the same time, set up Departments and set the lib folder to JARS (a folder dedicated to storing jar packages)

 

After the above work is completed, the preparation work is only the last step. . .

Binding configuration Tomcat

Set the path of Tomcat on your own computer at Configure

Then at Department , bind Artifact (product). This means that Tomcat is really running the file resources in the out directory.

The out directory will be created before the web project actually runs, and it will copy all the files in the web directory.

After completing the above work, the related deployment work of the entire Web project has come to an end, and then start to write the source files that your project needs to actually run.

 

In the first web project, I just completed a " portal " website with basic registration and login functions.

The knowledge points involved include Servlet JSP JavaBean JDBC and so on.

The division of labor of the entire business module is as follows :

The source code can be attached to my github: https://github.com/nbeep/Web-

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324453828&siteId=291194637