前言
最近微信里的童鞋让看一个错误,这是一个web练手项目,项目用到原生Servlet和jsp老技术,它是用eclipse
搞的,奈何我放弃eclipse已多年,在IDEA里我还真没搞过这种没用到maven
的web
项目(jar
包手动下载拷贝到WEB-INF
下),故将配置过程记录于此。方便日后学习。
导入到IDEA
点击import Project:
![3f7b993caeb0d3aaf42da066814f392a.png](https://img-blog.csdnimg.cn/img_convert/3f7b993caeb0d3aaf42da066814f392a.png)
找到eclipse中的项目,点击OK:
![b0e4933838df22f2635af782e6de2154.png](https://img-blog.csdnimg.cn/img_convert/b0e4933838df22f2635af782e6de2154.png)
选择Create Project from existing sources
,选择Eclipse
,点击Next
:
![8bd58cb1a11ea05ce82c3e28686fbbfb.png](https://img-blog.csdnimg.cn/img_convert/8bd58cb1a11ea05ce82c3e28686fbbfb.png)
一路Next
:
![72f3dd20e666c8d6346eeef7156d7dc3.png](https://img-blog.csdnimg.cn/img_convert/72f3dd20e666c8d6346eeef7156d7dc3.png)
勾选项目中的jar
文件:
![b7b1ca420d14abf36d383680e982ab1e.png](https://img-blog.csdnimg.cn/img_convert/b7b1ca420d14abf36d383680e982ab1e.png)
然后一路Next
,这里提示重写idea
配置文件,点击Overwrite
:
![5ff3cc238760c4e3dd2f4fb770a11173.png](https://img-blog.csdnimg.cn/img_convert/5ff3cc238760c4e3dd2f4fb770a11173.png)
最后选择jdk
路径,点击Next
:
![491b9e539b88c4fcf27646f8914fd035.png](https://img-blog.csdnimg.cn/img_convert/491b9e539b88c4fcf27646f8914fd035.png)
点击完成
:
![d658e970965b425e9f9a693389f1d79c.png](https://img-blog.csdnimg.cn/img_convert/d658e970965b425e9f9a693389f1d79c.png)
导入成功:
![ff5da9b380ceca08c4c2848d033a6443.png](https://img-blog.csdnimg.cn/img_convert/ff5da9b380ceca08c4c2848d033a6443.png)
配置编译环境
在项目上右键单击选择Open Model Settings
,快捷键F12:
![0af92ea7d614861b10eac1454744bd9e.png](https://img-blog.csdnimg.cn/img_convert/0af92ea7d614861b10eac1454744bd9e.png)
选择Artifacts
、Web Application Exploded
、Empty
:
![1a57a2ec7c58fce6ea6bd15c95e1520d.png](https://img-blog.csdnimg.cn/img_convert/1a57a2ec7c58fce6ea6bd15c95e1520d.png)
填写Name
,我这里填写product
:
![88eef1abc3d7ea1bbc2a794d6a31b43e.png](https://img-blog.csdnimg.cn/img_convert/88eef1abc3d7ea1bbc2a794d6a31b43e.png)
如图所示,然后点击OK
![29c71376144f89b9bda2f692cbc68a6c.png](https://img-blog.csdnimg.cn/img_convert/29c71376144f89b9bda2f692cbc68a6c.png)
选择Modules
,点击+
,Library
:
![5f6c3749394bf1fba4a7ab44a931c461.png](https://img-blog.csdnimg.cn/img_convert/5f6c3749394bf1fba4a7ab44a931c461.png)
将Application Server Libraries
下的Tomcat库
选择上,因为Servlet相关的包需要用到
![5bda72c677312dfea8f2e3751bd8dd5c.png](https://img-blog.csdnimg.cn/img_convert/5bda72c677312dfea8f2e3751bd8dd5c.png)
配置完成后,点击Build->Build Artifacts
:
![6b81b7cf90480ea2a10d061ce36e644b.png](https://img-blog.csdnimg.cn/img_convert/6b81b7cf90480ea2a10d061ce36e644b.png)
点击$name->Build
开始编译:
![63dc355919f2e77feb31fbcc264dccca.png](https://img-blog.csdnimg.cn/img_convert/63dc355919f2e77feb31fbcc264dccca.png)
配置运行环境
点击Edit Configuration
:
![v2-f8644c629551a53607b20f1b1611a8de_b.png](http://img-03.proxy.5ce.com/view/image?&type=2&guid=a917c17c-df30-eb11-8da9-e4434bdf6706&url=https://pic3.zhimg.com/v2-f8644c629551a53607b20f1b1611a8de_b.png)
点击+、Tomcat Server、Local
![798cf50b7eebf60b76a28b68379e1471.png](https://img-blog.csdnimg.cn/img_convert/798cf50b7eebf60b76a28b68379e1471.png)
填写名称,在Server
下填写对应配置,(默认即可):
![a8108ae53a676d39e0f02a77b3aa2cc1.png](https://img-blog.csdnimg.cn/img_convert/a8108ae53a676d39e0f02a77b3aa2cc1.png)
选择Deployment
,点击+、Artifact
:
![84058ec80a5fb1d77aff185921efac78.png](https://img-blog.csdnimg.cn/img_convert/84058ec80a5fb1d77aff185921efac78.png)
选择$name
,我这里即为product
,最后点击OK
:
![9fbaf3d8b2b1a01194ab1c45f6b45de9.png](https://img-blog.csdnimg.cn/img_convert/9fbaf3d8b2b1a01194ab1c45f6b45de9.png)
点击运行后,控制台打印部署成功:
![8428e4d89de8193ae085016797ceaef9.png](https://img-blog.csdnimg.cn/img_convert/8428e4d89de8193ae085016797ceaef9.png)
访问http://localhost:8080/register.jsp
:
![bf51763be9203add382c7597c4b837ac.png](https://img-blog.csdnimg.cn/img_convert/bf51763be9203add382c7597c4b837ac.png)
作者简洁
作者:小碗汤,一位热爱、认真写作的小伙,目前维护原创公众号:『我的小碗汤』,专注于写go语言、docker、kubernetes、java等开发、运维知识等提升硬实力的文章,期待你的关注。转载说明:务必注明来源(注明:来源于公众号:我的小碗汤,作者:小碗汤)