struts2中struts.xml 放置路径的问题】的更多相关文章

在搭建struts2项目时如果在web.xml中不指定struts.xml文件的路径,struts2会默认到/WEB-INF/classes中寻找加载其配置文件的,但我就是想把struts的配置文件放到我指定的位置下,这时该如何处理呢?我做了以下实验: 先看一下项目的文件结构: 我把struts的配置文件放到了/WEB-INF/deploy/pms/app-config/struts-config/下,并且在web.xml中的配置如下: <filter> <filter-name>…
1.    深入Struts2的配置文件 本部分主要介绍struts.xml的常用配置. 1.1.    包配置: Struts2框架中核心组件就是Action.拦截器等,Struts2框架使用包来管理Action和拦截器等.每个包就是多个Action.多个拦截器.多个拦截器引用的集合. 在struts.xml文件中package元素用于定义包配置,每个package元素定义了一个包配置.它的常用属性有: l name:必填属性,用来指定包的名字. l extends:可选属性,用来指定该包继承…
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…
web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_9" version="2.4" xmlns="http://Java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:sche…
一.web应用的classpath简介   classpath路径,即WEB-INF下面的classes目录,所有src目录下面的java.xml.properties等文件编译后都会在此. Struts 2框架有两个核心配置文件:struts.xml文件主要负责管理应用中的Action映射,以及Result定义等.                                                             struts.properties文件,定义了Struts…
struts.xml 为Struts 2的核心配置文件.struts.xml文件主要负责管理应用中的Action映射,以及该Action包含的Result定义等.struts.xml中主要配置Struts项目的一些全局的属性,用户请求和响应Action之间的对应关系,以及配置Action中可能用到的参数,以及处理结果的返回页面.还包括各种拦截器的配置等.…
结果页面的配置: 红色的比较常用 …
struts2.X配置文件默认存放路径在/WEB-INF/classes目录下,即将struts.xml放在src的目录下. 但是为了方便管理,开发人员把struts.xml放到其他位置,处理方法如下. 首先要明白struts2加载配置文件都是从自己的jar包和/WEB-INF/classes两个默认的位置加载的. 若修改struts2.x配置文件的存放位置,在web.xml配置过虑器时,具体配置如下: <filter> <filter-name>struts2</filte…
访问HelloWorld应用的路径的设置 * 在struts1中,通过<action path=“/primer/helloWorldAction.action”>节点的path属性指定访问该action的URL路径. * 在struts2中,访问struts2中action的URL路径由两部份组成:包的命名空间+action的名称,例如:      访问HelloWorldAction的URL路径为: /primer/helloWorldAction.action  (注意:完整路径为:ht…
在struts2框架中struts.xml是应当放到src的根目录,程序编译后会将struts.xml放到WEB-INF/classes目录下. Struts2在web.xml中的一般配置如下: <filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter <…