閱讀341 返回首頁    go 阿裏雲 go 技術社區[雲棲]


Stripes學習(一)

原文:https://blog.csdn.net/iisgirl/article/details/7479453

最近公司有一個項目要用stripes + spring(Spring JDBC)開發,用maven構建,linux(Ubuntu)係統,web服務器用websphere 6.0。

今天開始,深入淺出學習stripes,看看它優越於struts1的緣由究竟在哪裏。

備注:開發之前,請保證機器上已經安裝並且正確配置了java開發環境(jdk 5以上),maven等。

1、下載stripes的maven插件,stripes-archetype-quickstart-1.0.jar  Download

2、將stripes-archetype-quickstart-1.0.jar安裝到maven本地倉庫。

[plain] view plaincopy
  1. mvn install:install-file -Dfile=stripes-archetype-quickstart-1.0.jar -DgroupId=net.sourceforge -DartifactId=stripes-archetype-quickstart -Dversion=1.0 -Dpackaging=jar  

3、使用stripes插件創建第一個stripes工程

[plain] view plaincopy
  1. mvn archetype:generate -DarchetypeArtifactId=stripes-archetype-quickstart -DarchetypeGroupId=net.sourceforge -DarchetypeVersion=1.0 -DgroupId=tutorial -DartifactId=HelloWorld  

注意:第三步的時候,如果報錯:

[plain] view plaincopy
  1. Embedded error: org.apache.maven.archetype.downloader.DownloadNotFoundException:  
  2. Requested org.apache.maven.archetypes:stripes-archetype-quickstart:jar:1.0  
  3. download does not exist.  
  4. Unable to download the artifact from any repository  

報錯原因是.m2下缺少maven相關插件archetype。

請到這裏Download下載,然後將下載後的資源解壓,替換掉$HOME/.m2/repository/org/apache/maven這個目錄,然後再次執行,應該ok。

4、maven命令成功執行後,在$HOME(個人目錄)下會看到一個HelloWorld的工程,然後執行如下:

[plain] view plaincopy
  1. cd HelloWorld  
  2.   
  3.   
  4. mvn jetty:run  

5、jetty成功啟動後,去瀏覽器訪問https://localhost:8080/HelloWorld

就會看到:

[plain] view plaincopy
  1. Congratulations, you've set up a Stripes project!  
  2.   
  3. You are running Java version 1.6.0_24 on the Linux operating system.  

這樣,我們用maven的stripes插件構建的第一工程就ok了。

6、將該工程編譯成Eclipse工程

[plain] view plaincopy
  1. mvn clean install  

[plain] view plaincopy
  1. mvn eclipse:clean eclipse:eclipse -Dwtpversion=1.5 -DdownloadSources=true  

成功執行後,就可以將該工程import到Eclipse中了。

最後更新:2017-04-03 16:48:46

  上一篇:go windows中修改catalina.sh上傳到linux執行報錯This file is needed to run this program
  下一篇:go linux 之 popen函數