mac版MyEclipse的安裝及建立web項目

來源:互聯網
上載者:User

標籤:檔案複製   version   https   org   404錯誤   jsp   錯誤提示   back   att   

這兩天快被MyEclipse整死了,因為電腦是mac系統的,安裝MyEclipse mac破解版時一直是不成功,弄了一天多才行,接著建立web項目HttpServlet在Tomcat發布時總是出現404頁面,出現404當然是請求出問題了,但是我試了好多遍,也查了不少資料,路徑真的沒有問題,那麼問題在哪呢?經過不停的折騰 探索才明白是web.xml設定檔的問題.

先說一下MyEclipse mac破解版的安裝,我是根據這位大神的部落格提供的步驟安裝,傳送門:http://yangl.net/2015/08/21/myeclipse-2015-stable-2-0/ 

注意:一定要按照步驟來,順序不能亂,下載的源檔案及破解檔案一定是他提供的,我當初也是試過別人提供的破解方法,有成功的,但是過幾秒就閃退,說是檔案被篡改了.總之我是各種崩潰,其實這個破解方法也是有問題的,在他的部落格中第六條步驟是錯誤的,他說錯了,因該是把破解檔案中plugins這個檔案夾下的檔案複製到MyEclipse的plugins下(有合并的點合并),而不是將plugins這個檔案與MyEclipse下的plugins合并.再次注意:不要將plugins檔案直接複製過去,不然破解失敗.

第六步可能是作者的一個筆誤,但我耗費了一天的時間,真的太累了T_T.

再說說建立web項目,當我通過HttpServlet訪問建立的本地html檔案時出現404錯誤提示.各種設定最終找到了原因:在項目中web.xml檔案中缺少代碼:

未添加檔案

 1 <?xml version="1.0" encoding="UTF-8"?> 2 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> 3   <display-name>day02</display-name> 4   <welcome-file-list> 5     <welcome-file>index.html</welcome-file> 6     <welcome-file>index.htm</welcome-file> 7     <welcome-file>index.jsp</welcome-file> 8     <welcome-file>default.html</welcome-file> 9     <welcome-file>default.htm</welcome-file>10     <welcome-file>default.jsp</welcome-file>11   </welcome-file-list>12 </web-app>

添加代碼後的檔案

 1 <?xml version="1.0" encoding="UTF-8"?> 2 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> 3   <display-name>day02</display-name> 4   <servlet> 5       <servlet-name>ServletDemo</servlet-name> 6       <servlet-class>com.zhousong.web.servlet.ServletDemo</servlet-class> 7   </servlet> 8   <servlet-mapping> 9       <servlet-name>ServletDemo</servlet-name>10       <url-pattern>/servlet/ServletDemo</url-pattern>11   </servlet-mapping>12   <welcome-file-list>13     <welcome-file>index.html</welcome-file>14     <welcome-file>index.htm</welcome-file>15     <welcome-file>index.jsp</welcome-file>16     <welcome-file>default.html</welcome-file>17     <welcome-file>default.htm</welcome-file>18     <welcome-file>default.jsp</welcome-file>19   </welcome-file-list>20 </web-app>

按理說編譯器會自動產生缺失的那段代碼,至於為什麼沒有產生我也是迷惑,好在找到了根源,繼續代碼之路.

 

mac版MyEclipse的安裝及建立web項目

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.