建立 eclipse-jee-helios+Tomcat 7.0的JSP開發環境

寫這個文章的原因是eclipse-jee下創建Tomcat server的資料太少了,可能因爲太簡單了大牛們都不願意寫吧。

我是新手,初次接觸JAVA和JSP,在這個環節上遇到了問題,所以記錄下來供大家參考。

 

java的環境不介紹了,相信各位都配置好了。

我下載了最新版本的 eclipse-jee和Tomcat server(eclipse-jee-helios-SR2-win32.zip和Tomcat 7.0),安裝後http://localhost:8080能顯示正確的頁面。 使用eclipse編寫了hello.jsp放在 在 D:/Tomcat 7.0/webapps/myhello下面

輸入 http://localhost:8080/ myhello /hello.jsp 也能正常訪問。

 

每次寫完JSP都要這樣調試太麻煩了,下面進入主題, eclipse-jee下創建Tomcat server。

 

先閱讀eclipse的help:

"Creating a Tomcat server

...
To create a Apache Tomcat server:

1.In the Servers view, right-click and select New > Server. The Define a New Server wizard opens.
2.In the Select the server type list, select the Tomcat server defined in the previous step.
Tip: If you did not specify the Tomcat install directory, the Define a New Server wizard will prompt you for this information.
3.Start the Tomcat server. In the Servers view, right-click the Tomcat server and select Start.
4.Test your setup of the Tomcat server.
a.Open a Web browser.
b.Type the Web address http://localhost:8080/. If you see the Apache Tomcat start page, you have successfully set up your Tomcat server.

"

對於最後,測試在eclipse-jee下創建Tomcat server是否成功,我是這樣做的:

在SERVER面板上右鍵,執行 start。結果卻提示:8005、8080、8009端口衝突。分析:既然創建了新的SERVER,那麼當前運行的SERVER停止, 新的SERVER才能啓動吧。於是我停止了 當前運行的SERVER(D:/Tomcat 7.0),然後再 在SERVER面板上右鍵,執行 start。一串紅的ERROR的調試信息後,eclipse中的SERVER狀態變爲[started,synchronized]----原來是 [stopped,synchronized]

 

eclipse中的SERVER狀態變爲[started,synchronized],點擊工具欄上的綠色運行按鈕,我建立的hellojsp (dynamic web project) 就有正確輸出了。

 

zxyu 2011-5-28

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章