Stripes学习(一)

来源:互联网 发布:mac充电器灯不亮 编辑:程序博客网 时间:2024/05/16 14:50

最近公司有一个项目要用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本地仓库。

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工程

mvn archetype:generate -DarchetypeArtifactId=stripes-archetype-quickstart -DarchetypeGroupId=net.sourceforge -DarchetypeVersion=1.0 -DgroupId=tutorial -DartifactId=HelloWorld

注意:第三步的时候,如果报错:

Embedded error: org.apache.maven.archetype.downloader.DownloadNotFoundException:Requested org.apache.maven.archetypes:stripes-archetype-quickstart:jar:1.0download 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的工程,然后执行如下:

cd HelloWorldmvn jetty:run

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

就会看到:

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工程

mvn clean install

mvn eclipse:clean eclipse:eclipse -Dwtpversion=1.5 -DdownloadSources=true

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

原创粉丝点击