struts.xml配置:

<struts>
<package name="hw" namespace="/test" extends="struts-default">
<action name="helloworld" class="com.self.action.HelloWorldAction" method="dohelloworld">
<result name="doresult">
/WEB-INF/actionpage/showresult.jsp
</result>
</action>
</package>
</struts>

正确访问路径:http://localhost:8080/Struts2_01/test/helloworld

如果浏览器访问路径:

先访问路径:“http://localhost:8080/Struts2_01/test/aa/bb/cc/dd/helloworld”没找到!

再访问路径:“http://localhost:8080/Struts2_01/test/aa/bb/cc/helloworld”也没找到!
...... 直到路径:“http://localhost:8080/Struts2_01/test/helloworld”找到了,返回界面显示

  

如果还找不到:就到默认<package></package>里面找

<!-- 默认配置:namespace属性为空 -->
<package name="hw" namespace="" extends="struts-default">
<action name="helloworld" class="com.self.action.HelloWorldAction" method="dohelloworld">
<result name="doresult">
/WEB-INF/actionpage/showresult.jsp
</result>
</action>
</package>

  

Struts2的Action名称搜索顺序:2014.12.30的更多相关文章

  1. 【Struts2学习笔记(1)】Struts2中Action名称的搜索顺序和多个Action共享一个视图--全局result配置

    一.Action名称的搜索顺序 1.获得请求路径的URI,比如url是:http://server/struts2/path1/path2/path3/test.action 2.首先寻找namesp ...

  2. 02. struts2中Action名称的搜索顺序

    搜索顺序 获得请求路径的URI,例如URL为:http://localhost:8080/struts2/path1/path2/path3/student.action 首先寻找namespace为 ...

  3. Action的搜索顺序(Struts2搜索Action的机制)

    当访问如下链接时, http://localhost:8080/struts2Demo/path1/path2/path3/LoginAction.action 第一步:判断当前路径下action是否 ...

  4. Sturts2中Action的搜索顺序

    http://localhost:8080/ProjectName/path1/path2/path3/XX.action 首先会判断以/path1/paht2/path3为namespace的pac ...

  5. Struts2学习三----------Action搜索顺序

    © 版权声明:本文为博主原创文章,转载请注明出处 Struts2的Action的搜索顺序 http://localhost:8080/path1/path2/student.action 1)判断pa ...

  6. 第二篇——Struts2的Action搜索顺序

    Struts2的Action的搜索顺序: 地址:http://localhost:8080/path1/path2/student.action     1.判断package是否存在,例如:/pat ...

  7. Struts2配置拦截器,struts2加载常量时的搜索顺序

    1:struts2加载常量时的搜索顺序 1.Struts-default.xml 2.Struts-plugin.xml 3.Struts.xml 4.Struts-properties(自己创建的) ...

  8. struts2 模型驱动的action赋值优先顺序

    struts2 模型驱动的action赋值优先顺序: 1.优先设置model的属性. 2.如果model属性中没有对应的成员变量,则向上冒泡,寻找action中的属性进行set. 如果action中的 ...

  9. struts中action名称反复导致的神秘事件

    近期由于项目需求变更.须要本人对当中的某个业务功能进行改动.本人依照前台页面找action,依据action找代码的逻辑进行了改动(公司项目是ssh框架,struts配置全部是通过注解的方式进行.配置 ...

随机推荐

  1. 高德地图API应用

    高德地图官网:http://api.amap.com/javascript/ 输入关键字,搜索地址功能的网页: 1.引用远程Map Api(js)网址形式(注册后获取) 2.定义个<div> ...

  2. Python基本数据类型之list列表

    列表是python中用的非常频繁的数据结构,它是有序序列.之前学的字符串就是一种有序序列.不过列表是可变的. 创建列表 li = list( )                          #构 ...

  3. DependencyProperty深入浅出

    写这篇心得之前,看到博友一句话:需求是推动发展的原动力. 说得好,说的棒,说到了点子上,说到了心里去: 好我们开始 最初的世界是简单的,甚至比单细胞动物还简单: 普通属性定义 public class ...

  4. Python 时间 日期常见操作

    import datetime,time dtstr = '2014-02-14 21:32:12' a = datetime.datetime.strptime(dtstr, "%Y-%m ...

  5. const 修饰函数

    At the very first ,I got a problem . Vector Vector::operator+(const Vector &v)const{ return Vect ...

  6. 过滤android应用列表(区分系统应用、第三方应用、sd卡中的应用)

    if ((app.flags & ApplicationInfo.FLAG_SYSTEM) != 0) { // 系统程序 }else if ((app.flags & Applica ...

  7. 常用jQuery代码02

    一.each函数拿到每个元素的宽度 setTimeout(function () { $(".sticker_list img").each(function () { var W ...

  8. [LeetCode]题解(python):057-Insert Interval

    题目来源 https://leetcode.com/problems/insert-interval/ Given a set of non-overlapping intervals, insert ...

  9. 解决调用context.Session["NAME"]时总出现Object reference not set to an instance of an object.异常的方法

    if (context.Session != null) { }

  10. php object转数组示例

    原本是这样格式的数据: object(Thrift\Server\PageCards)#32 (3) { ["cards"]=> array(10) { [0]=> o ...