IT忍者神龟之Struts2.xml配置全然正确流程能走通可是有红叉解决
一:Multiple annotations found at this line:Undefined
actionName parameter Undefined
actionnamespace parameter
这个红色叉叉报错:
Multiple annotations found at this line:
- Undefined actionName
parameter
- Undefined actionnamespace
parameter
可是不影响功能,可是配置多了。非常难看
自己网上找了非常多类似的资料
这种错误的原因有非常多,我先列出我所知道的原因
另外一个是我自己项目的原因,我的原因就在于自己的第一个没大写
这是改完之后的图
二:struts2.xml中使用chain和redirectAction这两个注意事项
当在struts.xml中使用chain和redirectAction这两个类型结果的时候,会报检查错误!
Multiple annotations found at this line:
-
Undefined actionnamespace
parameter
-
Undefined actionName parameter
相信不少朋友会被这个错误折腾的非常难受吧。如今说下解决方式,在百度和google上搜了非常久,国外站点也看了下,半天都没找到解决方法。后来无意中在apache的站点上看到了struts2 chain的使用说明,细致读了一下。就想到了一个办法,也许能够解决。于是就測试了一下,发现问题全然攻克了,如今来说下一我的解决方法。
chain结果类型有4个属性,各自是:
actionName
(default) - the name of the action that will be chained to
namespace
- used to determine which namespace the Action is in that we're chaining. If namespace is null, this defaults to the current namespace
method
- used to specify another method on target action to be invoked. If null, this defaults to execute method
skipActions
- (optional) the list of comma separated action names for the actions that could be chained to
当中actionName和namespace是不可缺少的,否则就会报错。所以我在项目中就写成例如以下形式:
<package name="struts" extends="struts-default" namespace="/bg">
<action
name="login" class="loginAction">
<result
type="chain">
<param
name="actionName">index</param>
<param
name="namespace">/bg</param>
</result>
</action>
</package>
可是这么写就有一个问题。我的项目比較简单,不想使用命名空间。于是我就想怎么解决问题呢,在看官方文档的时候我发现这么一句话:
A root namespace ("/") is also supported. The root is the namespace when a request directly under the context path is received. As with other namespaces, it will fall back to the default ("")
namespace if a local action is not found.
于是我就想。用"/"取代"/bg"不就能够解决这个问题了么。然后就把代码写成例如以下形式
<package name="struts" extends="struts-default" namespace="/">
<action
name="login" class="loginAction">
<result
type="chain">
<param
name="actionName">index</param>
<param
name="namespace">/</param>
</result>
</action>
</package>
好了讲到这里我想大家也都明确了该怎么解决chain和redirectAction这两个类型结果(type-result)报检查错误(validation)的问题了吧!
有多的不正确的地方还请大家多多不吝赐教!
!
IT忍者神龟之Struts2.xml配置全然正确流程能走通可是有红叉解决的更多相关文章
- pom.xml内容没有错,但一直报错红叉 解决办法
转自:http://www.cnblogs.com/sxdcgaq8080/p/5590254.html [maven] pom.xml内容没有错,但一直报错红叉 解决办法 1.首先看一下下面的这两个 ...
- Struts2 XML配置详解
struts官网下载地址:http://struts.apache.org/ 1. 深入Struts2的配置文件 本部分主要介绍struts.xml的常用配置. 1.1. 包配置: S ...
- struts2 --xml配置
struts2.5 官方文档介绍 这个是struts2.5给出的web.xml配置方式,核心包已经被挪到了ng的上一层 <web-app id="MyStrutsApp" v ...
- spring 整合 struts2 xml配置
整合之前要搞清楚struts2是什么; struts2:表现层框架 增删改查 作用域 页面跳转 异常处理 ajax 上传下载 excel 调用service spring :IOC/ ...
- spring boot的pom.xml配置,正确生成jar包
spring boot生成的jar包提示没有主清单属性. 需要在pom里加入配置. <?xml version="1.0" encoding="UTF-8" ...
- 【maven】 pom.xml内容没有错,但一直报错红叉 解决办法
1.首先看一下下面的这两个项目,一个是新建的,一个是原来的老项目 2.myEcplise中是点击如下图 Maven4MyEcplise, Ecplise中也是右键,只不过点击Mavene而已,两个一样 ...
- struts2视频学习笔记 22-23(基于XML配置方式实现对action的所有方法及部分方法进行校验)
课时22 基于XML配置方式实现对action的所有方法进行校验 使用基于XML配置方式实现输入校验时,Action也需要继承ActionSupport,并且提供校验文件,校验文件和action类 ...
- Struts2笔记——struts.xml配置详解
访问HelloWorld应用的路径的设置 * 在struts1中,通过<action path=“/primer/helloWorldAction.action”>节点的path属性指定访 ...
- struts2.xml的配置与技巧
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-/ ...
随机推荐
- Chrome NativeClient创建 (转)
Chrome NativeClient创建 该demo目标是让chrome扩展启动本地exe 1创建一个名叫nativeMsgDemo的控制台程序 #include <Windows.h> ...
- Hash表的使用
Hash表能够实现在O(1)时间内对数据访问,虽然空间复杂度很高,但是时间复杂度很好.所以下面说一些使用Hash的算法. 第一个只出现一次的字符 利用Hash可以实现统计字符的个数,然后在遍历一次得到 ...
- Hadoop学习之YARN框架
转自:http://www.ibm.com/developerworks/cn/opensource/os-cn-hadoop-yarn/,非常感谢分享! 对于业界的大数据存储及分布式处理系统来说,H ...
- Android Sdk 国内镜像下载地址
大连东软信息学院镜像服务器地址:- http://mirrors.neusoft.edu.cn 端口:80北京化工大学镜像服务器地址:- IPv4: http://ubuntu.buct.edu.cn ...
- C# Excel或表格插件
NOPI好像比较好用对WINFORM支持更好! http://www.cnblogs.com/dreamof/archive/2010/06/02/1750151.html NOPI教程 http:/ ...
- 【LeetCode题意分析&解答】41. First Missing Positive
Given an unsorted integer array, find the first missing positive integer. For example,Given [1,2,0] ...
- 循环-21. 求交错序列前N项和
/* * Main.c * C21-循环-21. 求交错序列前N项和 * Created on: 2014年8月18日 * Author: Boomkeeper ***********测试通过**** ...
- Linux学习笔记之权限与命令之间的关系(重要)及文件与文件夹知识总结
一.让使用者能进入某文件夹成为可工作文件夹的基本权限为何: 可使用的命令:比如 cd 等变换工作文件夹的命令. 文件夹所需权限:使用者对这个文件夹至少须要具有 x的权限 额外需求:假设使用者想要在这个 ...
- js颜色转换
很久之前面试遇到过一个题.写个颜色转换的方法. function RGB2Color(r,g,b) { return '#' + byte2Hex(r) + byte2Hex(g) + byte2He ...
- 初识EF
1. EF是Entity Framework的缩写,全称是(ADO.Net Entity Framework),是以ADO.Net为基础所发展出来的对象关系对应(O/R Mapping)解决方案,早起 ...