当前位置:编程学习 > 网站相关 >>

Stripes学习(一)

最近公司有一个项目要用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]
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]
mvn archetype:generate -DarchetypeArtifactId=stripes-archetype-quickstart -DarchetypeGroupId=net.sourceforge -DarchetypeVersion=1.0 -DgroupId=tutorial -DartifactId=HelloWorld 
注意:第三步的时候,如果报错:

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

报错原因是.m2下缺少maven相关插件archetype。

请到这里Download下载,然后将下载后的资源解压,替换掉$HOME/.m2/repository/org/apache/maven这个目录,然后再次执行,应该ok。

4、maven命令成功执行后,在$HOME(个人目录)下会看到一个HelloWorld的工程,然后执行如下:

[plain]
cd HelloWorld 
 
 
mvn jetty:run 

5、jetty成功启动后,去浏览器访问http://localhost:8080/HelloWorld

就会看到:

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

这样,我们用maven的stripes插件构建的第一工程就ok了。

6、将该工程编译成Eclipse工程

[plain]
mvn clean install 

[plain]
mvn eclipse:clean eclipse:eclipse -Dwtpversion=1.5 -DdownloadSources=true 

成功执行后,就可以将该工程import到Eclipse中了。



摘自 昨日凡阳
 

补充:综合编程 , 其他综合 ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,