在eclipse下搭建struts2框架

2024-10-21 00:59:44

1、建立project,此处以demo为例。

在eclipse下搭建struts2框架

2、导入struts2的基础包,若没有struts2可到网上下载,将压缩文件加压后从lib文件夹下把以下jar复制到project的WEB-INF下的lib文件夹中commons-fileupload-xx.jar,commons-io-xx.jar,commons-lang3-xx.jar,freemarker-xx.jar,ognl-xx.jar,struts2-core-xx.jar,xwork-core-xx.jar;其中xx代表不同的版本号。

在eclipse下搭建struts2框架

3、配置web.xml文件。图中1是头文件,2、3是struts2核心过滤器配置;

在eclipse下搭建struts2框架

4、配置struts.xml文件。主要是对action的配置。

在eclipse下搭建struts2框架

5、到此为止基本的框架就搭建好了,能够满足初学用了。

猜你喜欢