Six, IDEA-- Java Web Module to create and configure tomcat and Database

First, create a Java Web Project or Module

1 Create a static Java Web
clickpath
File-New-Module ...
Here Insert Picture Description

Here Insert Picture Description
Then create a static file in the module files (html, css, etc.)

2 create dynamic Java Web

2.1 of creating dynamic Web module

Engineering bar space new - module:

Here Insert Picture Description
Here Insert Picture Description

Here you must check the Web Application, you can create a Web project.
Here Insert Picture Description
It provides Web project name. Note here that tinkering Content root and Module file location.
After the creation of the project is structured as follows:

Here Insert Picture Description
Open index.jsp. Modified to read as follows. Here you will find the code hinting IDEA better than Eclipse.
Here Insert Picture Description
3 Configuring Tomcat
Before you configure Tomcat in the IDEA, the need to ensure that Tomcat is already installed and configured the environment variables. If not installed and configured, after the configuration, at the command line: catalina run. Can start tomcat, the installation configuration proved successful.

Let's look at how to configure the IDEA:

1) Click Edit Configurations:
Here Insert Picture Description

2) + Click here to choose TomEE Server or Tomcat Server can be. Then select Local.
Here Insert Picture Description
3) the location where the configuration of Tomcat and configuring the name of the application server. Depending on the installation location of their decision Tomcat.
Here Insert Picture Description
Other positions default value (set to start the browser and a port number), as described above
Here Insert Picture Description

Then deployment, Application context complete the project name:
Here Insert Picture Description
Click OK to
Here Insert Picture Description
start tomcat
Here Insert Picture Description

http request configuration, index.jsp effect executed just created as follows:

Here Insert Picture Description

Information display after running Tomcat:
Here Insert Picture Description
you can click on the red box, just click finish and can not shut down the server immediately, just disconnect from the server, and
later when the stop button is grayed out, it means closed.

4 associated database
1) associatively
Click DataBase- ± Click right side - Select Data Source
Here Insert Picture Description
fill in the name of the database user name and password
Here Insert Picture Description
Here Insert Picture Description
on the surface of a lot of people think Configuration Database is to have a GUI database management functions, but this is not for IntelliJ IDEA Database The most important features. There are many GUI tool database, IntelliJ IDEA's Database not too obvious advantages. After Database is the biggest characteristic of IntelliJ IDEA for Java Web projects is concerned, ORM framework commonly used, such as Hibernate, Mybatis have good support, such as the Database configured, IntelliJ IDEA will automatically recognize the relationship between domain objects and data tables, domain may be generated by objects, etc. Database data tables directly.

Common database operations
Here Insert Picture Description

Icon 1: synchronize the current database connection. This is the most important operations. After configured connection or through other means
, the need for timely operation after the synchronization database.
Icon 2: Configure current connection.
Icon 3: Disconnect the current connection.
Icon 4: the display data database objects
icon 5: Editing modify the current database object

Guess you like

Origin blog.csdn.net/m0_38143867/article/details/92786540