Versions Compared

Key

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

...

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


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

然后在eclipse中运行该项目 Image Added
Step 3 - 添加Struts 2的jar文件到Class Path

我们添加Struts 2最小需求的jar包。我们将把这些jar包拷贝到WEB-INF\lib这个文件夹中。

找到并拷贝这些文件

  1. asm-x.x.jar
  2. asm-commons-x.x.jar
  3. asm-tree-x.x.jar
  4. commons-fileupload-X.X.X.jar
  5. commons-io-X.X.X.jar
  6. commons-lang3-X.X.X.jar
  7. commons-fileupload-X.X.X.jar
  8. freemarker-X.X.X.jar
  9. javassist-X.X.X.jar
  10. ognl-X.X.X.jar
  11. struts2-core-X.X.X.X.jar
  12. xwork-core-X.X.X.jar

You can see from the above that the Struts 2 core jar depends on several other artifacts. As we add additional Struts 2 features in future tutorials, we'll need to add additional Struts 2 jar files and other transitive dependencies.

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