Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

你可以从Google Code - http://code.google.com/p/struts2-examples/downloads/list下载所有的例子。

在下面选择一个你熟悉的技术(Ant或Maven)Create Struts 2 Web Application With Artifacts In WEB-INF lib and Use Ant To Build The Application

Ant

你可以下载这个完整的例子,Basic_Struts_Ant下载地址上面已经说了。下载完了后解压缩,得到 Basic_Struts2_Ant这个目录,里面有Readme.txt它介绍了如何建立和运行这个程序。

为了建立这个程序你需要下载Struts 2并将其jar包加入到你的Classpath。下载入口Struts 2

Step 1 - 创建一个基本的Web程序

在你的java IDE 里面创建一个Web application project命名为Basic_Struts2_Ant,下面是截图

Image Added
Step 2 - 添加一个index.jsp和Ant文件
添加一个简单的index.jsp页面,他的title是Basic Struts 2 Application - Welcome,他的内容是Welcome to Struts 2!
接着创建一个build.xml文件

Create Struts 2 Web Application Using Maven To Manage Artifacts and To Build The Application