在eclipse下搭建struts2框架

2025-07-03 04:52:06

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、到此为止基本的框架就搭建好了,能够满足初学用了。

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢