struts2 环境配置

来源:互联网 发布:c语言实现base64编码 编辑:程序博客网 时间:2024/06/05 02:11

以 2.1.7 版本为例,其他版本请参考struts2官网

一、导入jar包

            struts2-core.jar    //核心jar包
            xwork-2.jar    // xwork核心jar包
            ognl.jar    //ognl表达式            
            freemarker.jar    //FreeMarker模板            
            commons-logging.jar    //日志
            commons-fileupload.jar    //文件上传            
            commons-io.jar    //文件上传依赖的包


二、编写 struts.xml 配置文件

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts PUBLIC"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN""http://struts.apache.org/dtds/struts-2.3.dtd"><struts></struts>

三、在 web.xml 中注册struts2过滤器

<filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class></filter><filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern></filter-mapping>


0 0