`
安之若素
  • 浏览: 145023 次
  • 性别: Icon_minigender_2
  • 来自: 北京
社区版块
存档分类
最新评论

Could not find action or result

阅读更多

 

一个很怪的问题。

控制台异常:
[org.apache.struts2.dispatcher.Dispatcher]-[WARN] Could not find action or result
There is no Action mapped for namespace /jsp/schedule and action name addMynoteAction. - [unknown location]


这是struts.xml文件Action的配置:

 

        <!-- 查询我的便签列表 -->
        <action name="findMynoteListAction" class="mynoteAction" method="findMynoteList">
            <result name="success" >/jsp/schedule/myNoteList.jsp</result>
        </action>
        
        
        <!-- 添加便签【只有这个Action找不到】 -->
        <action name="addMynoteAction"  class="mynoteAction" method="addMynote">
            <result  type="redirectAction">findMynoteListAction</result>
            <result name="input">/jsp/schedule/myNoteAdd.jsp</result>
        </action>
        
        <!--  删除便签 -->
        <action name="deleteMynoteAction" class="mynoteAction" method="deleteMynote">
            <result type="redirectAction" >findMynoteListAction</result>
        </action>

        <!-- 根据ID查询便签 -->
        <action name="findMynoteByIdAction" class="mynoteAction" method="findMynoteById">
            <result name="success" >/jsp/schedule/myNoteUpdate.jsp</result>
            <result name="error" type="redirectAction">findMynoteListAction</result>
        </action>
        
        <!-- 更新便签  -->
        <action name="updateMynoteAction" class="mynoteAction" method="updateMynote">
            <result name="success" type="redirectAction">findMynoteListAction</result>
            <result name="input" type="redirectAction" >findMynoteByIdAction</result>
        </action>

 

 

这是struts.xml文件package声明:

<package name="default" extends="struts-default" namespace="/">

 

 

 

这是jsp页面form表单调用Action的代码:用的是绝对路径

<form name="form1" method="post" action="${basepath}addMynoteAction.action">

 

 

    配置文件中写的都一样,只是name不一样,页面调用的方法都一样,所有页面也在同一个文件夹下,可是根本就找不到调用的这个Action,写的是绝对路径啊,除了增加(addMynoteAction),其他功能都没问题。


   我把struts.xml文件中namespace="/"属性去掉后,就不报404错误了,所有功能都实现了,可是。。增加成功返回到列表页面时,图片都显示不出来了。。其他功能删除修改等完成后返回列表图片都正常啊。页面图片用的都是绝对路径。

 

    后来我又把namespace="/"加上,发现别的页面调用这个addMynoteAction都没问题,唯独这个页面调用哪个Action都错误,我又重新建了新页面,忘记了删除jsp页面开头的

<base href="<%=basePath%>">,竟然不报错了,我习惯新建页面后把这句删了,因为以前做项目时,加上这句就

错。

 

    虽然项目不报错了,可是我还是不明白,别的页面、修改查询等页面都没有这句<base href="<%=basePath%>">,我习惯都用绝对路径,可是为什么别的页面没有这句就不报错,唯独这个增加

数据的页面没有这句就报错?这个模块所有页面都在一个文件夹里同一路径下。

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

分享到:
评论

相关推荐

    JAVA错误文档[归纳].pdf

    2. **警告:Could not find action or result** 这个错误表示在Struts框架中找不到对应的动作映射。确保你的`struts.xml`文件中已经定义了相应的行为映射,例如`&lt;action name="attent" class=...

    JAVA错误文档.pdf

    1. Struts框架错误处理:文档中提到的“Dispatcher initialization failed”和“Could not find action or result”等信息表明Struts框架在初始化过程中遇到了问题。这通常发生在web.xml配置不当,或者struts.xml...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    - FIX: The result rectangle incorrectly calculated in the TFlexText.GetRefreshRect method. - FIX: Added FPaintCache.rcPaint cleanup in the TFlexPanel.WMPaint method. Now it is possible to define is ...

    OMG 业务动机模型 V1.3 英文版

    ’ that is, what result(s) the approach is meant to achieve. Sometimes it is difficult to uncover such motivation, especially in operations that have been going on for some time. All too often it ...

    CSharp英语

    Although "Prisoner" does not have a direct correlation with C# programming, it can be related to concepts such as "constrained execution environments" or "jailbreaking" in software development ...

    微软内部资料-SQL性能优化3

    Key range locks are similar to row locks on index keys (whether clustered or not). The locks are placed on individual keys rather than at the node level. The hash value consists of all the key ...

    曲线拟合工具CurveExpert 1.0

    point not being scaled or translated. Fixed. + A constant starting with a decimal (eg, .25) caused CurveExpert to bomb (when defining a user model). This has been fixed so that these constants ...

    php.ini-development

    directive because it is not set or is mistyped, a default value will be used. ; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one ; of the INI constants (On, Off, True, ...

    a project model for the FreeBSD Project.7z

    This is synonymous with deliverable, that is defined as “any measurable, tangible, verifiable outcome, result or item that must be produced to complete a project or part of a project. Often used ...

    Java邮件开发Fundamentals of the JavaMail API

    the ability to see how many new mail messages they have, are not supported by POP at all. These capabilities are built into programs like Eudora or Microsoft Outlook, which remember things like the ...

    高频词800词版本 342

    在例句中,"Positive thinking and action result in success.",表示积极的思想和行动会导致成功。 11. practical [præktɪkəl]:形容词,意思是实用的或实际的。在例句中,"The HUNCH program has an impact on...

Global site tag (gtag.js) - Google Analytics