与struts1框架的使用一样,struts2的环境搭建及使用同样分为以下几个步骤: 1. 引入jar包(这里以struts2.2.3为例),所需jar包有以下几个: a) struts2-core-2.2.3.jar b) xwork-core-2.2.3.jar c) commons-io-2.0.1.jar d) commons-lang-2.5.jar e) commons-fileupload-1.2.2.
首先在struts2.xml文件配置一个包,在包中配置一个action,新建action,新建视图,在action中定义由method定义的方法,这个方法一定要返回String类型,返回的是视图的名称. 直接上图 一,首先是pom.xml,引入所需jar <?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under