一、Struts配置文件

(1)struts-default.xml(框架自带)

定义了一些框架自带的Result组件,拦截器组件。
<package name="struts-default" abstract="true">  默认调用struts-default
<result-type> Result组件
<intercepter> 拦截器
<intercepter-stack>拦截器栈,默认在Action之前调用defaultStack拦截器栈
</package>
abstract="true"说明该包只能被继承
注意:该配置文件不可修改。

(2)struts.xml(开发者创建并使用)

<package namespace="命名空间 " name=" " extends=" ">
  namespace="/"   (默认) 请求路径:http://localhost:8080/webapp/
<action name="" class="Ation类路径" method="业务方法名">
<result></result>和<result name="success" type="dispatcher"></result>一样
<param></param>可以出现在<action>、<result>、<intercepter>中,为属性指定值
如:<action name="" class="" method="">
<param name="id">1</param>   //可以在Action中使用get/set方法
<result>.......
       </action>
定义开发者编写的Result组件,拦截器组件,Action组件

(3)default.properties

       在struts2-core jar包的org.apache.strut2下default.properties
       作用:框架定义的一些系统参数
       比如:默认编码utf-8,请求扩展名.action,文件上传解析器.......
注意:该文件是只读的。

(4)struts.properties

作用:用于覆盖default.properties中系统的配置

(5)struts-plugin.xml

整合插件包中带的配置文件,和struts,struts-default文件格式相同。

二、通配符的使用

* :任意字符串
请求: opt_add.action
<action name="opt_*" method="{1}" class="">  //add方法
请求:opt!add.action(动态方法调用)
<action name="opt" method="{1}" class="">     //add方法

三、隐藏访问页面

<action name="index">
<result>/opt.jsp</result>
<action>
在框架中可以这样做
WEB-INF目录一般不能被访问
可以将页面放到WEB-INF目录下
<action  name="index">
<result>/WEB-INF/opt.jsp</result>
<action>

Struts2——(2)配置文件、通配符的更多相关文章

  1. 【学习笔记】Struts2之配置文件struts.xml

    在默认情况下,Struts2只自动加载类加载路径下的struts.xml.default-struts.xml和struts-plugin.xml三类文件.但是随着应用规模的增大,系统中Action数 ...

  2. struts2默认配置文件 struts-default.xml

    注:用的struts2的版本是2.1.6 strtus2的默认配置文件 struts-default.xml ,其中的默认的拦截器,包括其中的拦截器栈. 因为struts2的配置文件struts.xm ...

  3. 六、Struts2的配置文件

    六.Struts2的配置文件 1.default.properties:在struts2-core-**.jar的org.apache.struts包中 关于Struts2一些常量配置(框架内部) s ...

  4. (转)struts2.0配置文件、常量配置详解

    一.配置: 在struts2中配置常量的方式有三种: 在struts.xml文件中配置 在web.xml文件中配置 在sturts.propreties文件中配置 1.之所以使用struts.prop ...

  5. struts2的配置文件

    struts2的配置文件 1.配置Action的struts.xml 2.配置Struts2有关属性的struts.properties

  6. struts2在配置文件与JSP中用OGNL获取Action属性

    参考:Struts与OGNL结合 struts2在配置文件中可以调用Action的属性,在JSP页面也可以取出Action的属性值(前提是属性有get,set方法). 第一个例子: 1.Action中 ...

  7. Struts2的配置文件中, <package>的作用,<action><result>重名?

    问:Struts2的配置文件中, <package>的作用是什么? 答:防止action重名啊,例如前台和后台,总会有很多地方起名重复的! 问:可是访问的时候,不也是访问action吗,能 ...

  8. Struts2 资源配置文件国际化

    Struts2 资源配置文件国际化 Struts2资源文件的命名规范:basename_language_country.properties Struts2国际化如果系统同时存在资源文件.类文件,系 ...

  9. Struts2(二)——配置文件struts2.xml的编写

    接上一篇博客,这篇博客讲述一下2——9小标题的内容,这些问题都可以在struts2配置文件中设置(当然有的也可以在Struts.properties属性文件,web.xml中进行设置),而且常规开发中 ...

  10. struts2的 result 通配符 OGNL

    result: 1). result 是 action 节点的子节点 2). result 代表 action 方法执行后, 可能去的一个目的地 3). 一个 action 节点可以配置多个 resu ...

随机推荐

  1. 使用mybatis generator 生成annotation形式的mapper

    最近使用mybatisgenerator时,希望生成annotation的mapper,在网上基本桑没有相关配置,记录,做以下记录: <?xml version="1.0"  ...

  2. Codeforces Round #258 (Div. 2)——B. Sort the Array

    B. Sort the Array time limit per test 1 second memory limit per test 256 megabytes input standard in ...

  3. [Angular] The Select DOM Event and Enabling Text Copy

    When we "Tab" into a input field, we want to select all the content, if we start typing, i ...

  4. UvaLive 6663 Count the Regions 离散化+DFS

    链接:http://vjudge.net/problem/viewProblem.action?id=49408 题意:在平面内给出若干个矩形,求出它们能将整个平面分成多少份. 思路:刚開始一眼看到认 ...

  5. php杂项函数

    php杂项函数 一.总结 看着函说作用 函数 描述 PHP     constant() 返回一个常量的值. 4 define() 定义一个常量. 3 defined() 检查某常量是否存在. 3 d ...

  6. cocos 关于文件名称的各种坑 各种斜杠坑

    cocos 全部文件路径 的斜杠 必须 用 /  而不能够用 \ 不然编译到安卓各种坑 相对路径 第一个字符不可 带 / /*比如 res/test.png 这样的应该是标准的 /res/test.p ...

  7. 得到INI文件所有Section(所有节点名称)

    char SectionNames[MAX_PATH],*pSectionName; ZeroMemory(SectionNames,MAX_PATH); GetPrivateProfileSecti ...

  8. 【a903】石子归并

    Time Limit: 10 second Memory Limit: 2 MB 问题描述 在一个圆形操场的四周摆放着N堆石子(N<= 100),现要将石子有次序地合并成一堆.规定每次只能选取相 ...

  9. ATL入门

    服务端代码----------------------------------------------------------------------------------------------- ...

  10. term- xshell VS securecrt

    Xshell使用技巧总结 https://www.cnblogs.com/zhangwuji/p/7155575.html SecureCRT与Xshell简单对比 http://ju.outofme ...