Use IntelliJ IDEA to create a new web project from scratch step by step! ! ! ! ! !

The most detailed IntelliJ IDEA project web project construction! ! ! ! ! !

1. Create a web project (the most troublesome to create for the first time)

1. Make sure the software is installed

2. Double-click to open the software --> create a new project

3. The web project selection is shown in the figure, first create an empty project space to place your project, this is a difference

Equivalent to myeclipse as shown in the figure

4. Create a project name

Equivalent to myeclipse as shown in the figure

5. Click fininsh, as shown in the figure, and ask whether the project you created is displayed on this page or on a new page. This depends on your needs. Here, the new page is used to distinguish it from my previous projects. (this is a difference)

6. At this time, the settings as shown in the figure will pop up. You need to set the JDK used, which is called SDK here.

7. If it does not pop up, you can open the settings as shown below

8. Set my JDK to 1.7 here

Equivalent to the setting of myelipse as shown in the figure below

9. Template settings

Choose as shown

As shown in the figure, the establishment project type is a web project, and then a web.xml document is required

Template naming

If you click finish at this time, you will find that a web project style is generated, and you can find that there are less things in the web folder 

Compare with myeclipse (IntelliJ's web is the same as myeclpse's webRoot)

Mainly, there are less two folders under WEB-INF, which are the output folders of the web project. Myeclipse automatically generates these two folders when it is created, but IntelliJ needs to set it up by itself later, these are the two of them a big difference

IntelliJ lacks the classes and lib folders, and needs to be created and then set separately, while myeclipse will be set when it is created, as shown in the figure

The position of the red circle is automatically set

Figure 3 shows the location of the Wenjia folder where web.xml and classes belong

Now set the classes and lib folders of IntelliJ as shown in the figure

Go to the position shown in the figure

Go to the position shown in the figure

Right-click to create a new folder (classes and lib)

Note: If the build error is temporarily ignored here, wait for the project to be ok, and then delete it

for example

Created one more lib under classes

Ignore it for now

10, classes and lib output path settings

Select Paths

Choose to use a template

configure your own path

Both top and bottom must be consistent

11. Set the path of lib output

choose the first

Click ok, the picture will pop up, select the red circle

完成后如图

这时就会发现项目中的classes和lib设置成功了

刚刚多余设置一个lib,在这里可以删除了

感觉这个设计的有些麻烦。

这样一个java web项目就建成了。

二、配置Tomcat服务器

 1、首次安装,看不到工具栏,需要把下边的view选项挑勾

2、会增加一条如图,需要改画圈的位置

点开它。选择红圈位置

选择加号建立一个自己的Tomcat服务器

选择如图

更改名字

3、关联你的tomcat6.0

点开configuration->点击加号

关联本地

注意:

这里关联的需要是环境变量配置好的JDK和Tomcat,否则启动时会报错.

关联成功后如图

设置启动后的打开路径

得到如图就是配置成功了

点击启动

启动不报错,如图

成功,会弹出界面

为了区分我们设置下界面

弹出界面

这里会出现端口占用情况

     windows+R.命令窗口查看端口占用

    

    发现这个2256占用了端口,把它关闭,然后就可以正常运行了

   CTRl+Alt+DEl,启动任务管理器

   

     找到pid为2256的pid,将它关掉,重启服务器,就会没问题了.

编码异常

设置编码为UTF-8,然后把Transparent打上勾,就会给中文翻译了.

 

 感谢您的支持,如果有问题,请留言!!!

Guess you like

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