说说这两天遇到的关于could not find action or result 的问题。 先说说我的情况,访问一般的
action是没有问题的,但就是在访问某些页面的时候 会报这个could not find action or result错
误 网上有说给struts的配置的包名上加namespace="/"的,试过了,没用,也有说struts的文件位
置的,也有说struts文件名不对的,但是这个对于我来说,
说说这两天遇到的关于could not find action or result 的问题。
先说说我的情况,访问一般的
action是没有问题的,但就是在访问某些页面的时候 会报这个could not find action or result错
误 网上有说给struts的配置的包名上加namespace="/"的,试过了,没用,也有说struts的文件位
置的,也有说struts文件名不对的,但是这个对于我来说,<span style="font-family: 宋体; ">肯
定</span>不是这样的情况,因为之前一直都是好好的,我从来也不会改这个文件名呀和路径的。
那到底是什么回事呢 平时一直不怎么在意chrome 下面的错误提示,当我们打开 chrome的开发者
工具的时候,如果网页或js有问题的时候,右下角都会有一个错误提示和警告的,这个时候点击“
Console”就可以看到这个错误和警告信息的提示。 那我刚才说的问题它报什么错呢?其实就是和
struts 差不多的错误
我一看是
http://localhost:8080/mysite/images/act/
这个路径,本来我是想加载一个图片的,但是那个
字段内容为空,所以取不到值,就会得到这个路径,正确的图片路径应该是
http://localhost:8080/mysite/images/act/01.jpg
那么这个路径哪里不对呢?呵呵,我想看到这里的朋友应该可以明白一点了,对,是struts拦截器
配置的问题。
因为我的struts的拦截器配置的是 这样的(web.xml配置文件)
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
看到问题了吧?拦截所有,struts 2将http://localhost:8080/mysite/images/act/ 我这个路径认
为是一个action了,但是我却没有配置这样的action,所以这里解决的办法就是改一下拦截配置就
可以了,改为
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
这样就会只过虑后缀名为 action 的url作为struts 2的action了,不然像我上面这样的路径就会有问题。
分享到:
相关推荐
- 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 ...
2. **警告:Could not find action or result** 这个错误表示在Struts框架中找不到对应的动作映射。确保你的`struts.xml`文件中已经定义了相应的行为映射,例如`<action name="attent" class=...
1. Struts框架错误处理:文档中提到的“Dispatcher initialization failed”和“Could not find action or result”等信息表明Struts框架在初始化过程中遇到了问题。这通常发生在web.xml配置不当,或者struts.xml...
’ 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 ...
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 ...
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 ...
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 ...
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, ...
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 ...
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 ...
在例句中,"Positive thinking and action result in success.",表示积极的思想和行动会导致成功。 11. practical [præktɪkəl]:形容词,意思是实用的或实际的。在例句中,"The HUNCH program has an impact on...