说说这两天遇到的关于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了,不然像我上面这样的路径就会有问题。
分享到:
相关推荐
在Myeclipse 8.5中用外带的tomcat时候,会因为JDK版本的问题出现Could not find the main class,按照上述文档的步骤就可以解决,我亲自体验过
Eclipse 编译时遇到错误could not find the main class,program will exit的解决方法
Could not find module 'D:\codna\Library\bin\geos_c.dll'Could not find module 'D:\codna\Library\bin\geos_c.dll'Could not find module 'D:\codna\Library\bin\geos_c.dll'
NULL 博文链接:https://liuenjian.iteye.com/blog/711927
Could not find Developer Disk Image"问题
百度飞桨遇到的问题,安装cuda不能启动,错误提示importError: Could not find 'cudnn64_7.dll'的解决。将压缩包内的文件对应放入cuda安装位置即可!
【故障解决】OGG-00446 Could not find archived log for sequence.pdf
WIN7下运行Jar文件提示Could not find the main class
xcode Could not find Developer Disk Image 11.4 (15F5061c) 亲测可用 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport 记得一定要重启Xcode才生效.
xcode 、could not find developer disk image、真机测试、ipa打包
xcode Could not find Developer Disk Image
解决Xcode在ipad/iphone9.2系统真机测试时出现could not find developer disk image问题,只要拷贝这个文件到/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport,然后重新启动...
打包找不到 zkclient COULD NOT FIND zkclient-0.11 解压后将jar包与pom文件都放在.m2\repository指定路径下
打包找不到 jcommander COULD NOT FIND jcommander-1.48 解压后将jar包与pom文件都放在.m2\repository指定路径下
主要介绍了Tensorflow安装问题: Could not find a version that satisfies the requirement tensorflow,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来...
打包找不到 RING-CORES问题 COULD NOT FIND cglib:cglib-2.2.2 解压后将jar包与pom文件都放在.m2\repository指定路径下
打包找不到 stream COULD NOT FIND stream-2.5.2 解压后将jar包与pom文件都放在.m2\repository指定路径下
打包找不到 classworlds问题 COULD NOT FIND classworlds-1.1-alpha-2 解压后将jar包与pom文件都放在.m2\repository指定路径下
NULL 博文链接:https://yintech.iteye.com/blog/374842
【SpringBoot】Error: Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster报错明细问题解决后记 报错明细 IDEA SpringBoot集成hadoop运行环境,,本地启动项目,GET请求接口触发...