
1.新建项目:file->project

注意这里不选Download,之后我们自己去官网下载
2.指定相关文件夹

在WEB-INF下建立好classes和lib文件后,指定classes为字节码输出文件夹,lib为jar包存放文件夹



在弹出的对话框选择刚才新建的lib文件夹

3.导入相关的jar包

解压后将所有的jar包导入到刚才新建的lib文件夹下并添加到library中

项目建立好后,IDEA自动帮我们生成了struts.xml
和web.xml
中过滤器的配置,我们需要手动配置一下struts.xml

其中的HelloAction是我们自己编写的测试用的action
package test;
import com.opensymphony.xwork2.ActionSupport;
public class HelloAction extends ActionSupport {
@Override
public String execute() throws Exception {
System.out.print("执行HelloAction.....");
return NONE;
}
}
运行项目,然后在浏览器中输入http://localhost:8080/hello.action

控制台输出了相应的日志,至此我们已经配置成功。
网友评论