7、 建立JavaWeb項目
-
建立工程
- 第一步
![在這裏插入圖片描述](http://static.javashuo.com/static/loading.gif)
- 第二步
![在這裏插入圖片描述](http://static.javashuo.com/static/loading.gif)
- 第三步 若是要修改JavaEE版本,請根據下圖所示進行修改
![在這裏插入圖片描述](http://static.javashuo.com/static/loading.gif)
- 第四步
![在這裏插入圖片描述](http://static.javashuo.com/static/loading.gif)
2. 發佈工程
- 第一步
![在這裏插入圖片描述](http://static.javashuo.com/static/loading.gif)
- 第二步
![在這裏插入圖片描述](http://static.javashuo.com/static/loading.gif)
- 第三步 點擊下圖中按鈕, 添加Tomcat環境
也能夠 點擊右下角的fix按鈕, 選擇以war exploded結尾的選項 ![在這裏插入圖片描述](http://static.javashuo.com/static/loading.gif)
- 第四步 注意: IDEA在部署項目時, 不會爲項目生成路徑. 例如本項目名爲javaweb, 有一個頁面爲index.html, 按照常規, 訪問路徑應爲 http://localhost:8080/javaweb/index.html . 可是在IDEA中部署後, 訪問路徑爲 http://localhost:8080/index.html . 若是要修改成第一種訪問路徑的話,須要手動按照下圖所示進行修改 .
![在這裏插入圖片描述](http://static.javashuo.com/static/loading.gif)
- 第五步 按照下圖所示進行修改. 若是沒有按照下圖進行配置, 在咱們每次修改頁面後,都要重啓服務器才能看到最新的效果.. 修改以後, 無需重啓服務器, 便可看到最新的效果.
![在這裏插入圖片描述](http://static.javashuo.com/static/loading.gif)
- 第六步 點擊下圖按鈕1啓動服務器.點擊按鈕2以Debug模式啓動服務器
![在這裏插入圖片描述](http://static.javashuo.com/static/loading.gif)
3. 添加第三方Jar
在WEB-INF文件夾中新建文件夾lib
2) 第二步 選擇下圖中的按鈕 Project Structure(Ctrl+Alt+Shift+s)
3) 第三步 按照下圖所示進行選擇
4) 第四步 選擇剛剛建立的lib目錄,並點擊OK
5) 第五步 選擇Jar Directory, 並點擊OK, 以後再次點擊OK
6) 第六步 按下圖所示進行配置. 配置成功後, 便可使用lib目錄存放的第三方Jar
html