一: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配置全然正确流程能走通可是有红叉解决的更多相关文章

  1. pom.xml内容没有错,但一直报错红叉 解决办法

    转自:http://www.cnblogs.com/sxdcgaq8080/p/5590254.html [maven] pom.xml内容没有错,但一直报错红叉 解决办法 1.首先看一下下面的这两个 ...

  2. Struts2 XML配置详解

    struts官网下载地址:http://struts.apache.org/   1.    深入Struts2的配置文件 本部分主要介绍struts.xml的常用配置. 1.1.    包配置: S ...

  3. struts2 --xml配置

    struts2.5 官方文档介绍 这个是struts2.5给出的web.xml配置方式,核心包已经被挪到了ng的上一层 <web-app id="MyStrutsApp" v ...

  4. spring 整合 struts2 xml配置

    整合之前要搞清楚struts2是什么; struts2:表现层框架  增删改查  作用域  页面跳转   异常处理  ajax 上传下载  excel   调用service spring :IOC/ ...

  5. spring boot的pom.xml配置,正确生成jar包

    spring boot生成的jar包提示没有主清单属性. 需要在pom里加入配置. <?xml version="1.0" encoding="UTF-8" ...

  6. 【maven】 pom.xml内容没有错,但一直报错红叉 解决办法

    1.首先看一下下面的这两个项目,一个是新建的,一个是原来的老项目 2.myEcplise中是点击如下图 Maven4MyEcplise, Ecplise中也是右键,只不过点击Mavene而已,两个一样 ...

  7. struts2视频学习笔记 22-23(基于XML配置方式实现对action的所有方法及部分方法进行校验)

    课时22 基于XML配置方式实现对action的所有方法进行校验   使用基于XML配置方式实现输入校验时,Action也需要继承ActionSupport,并且提供校验文件,校验文件和action类 ...

  8. Struts2笔记——struts.xml配置详解

    访问HelloWorld应用的路径的设置 * 在struts1中,通过<action path=“/primer/helloWorldAction.action”>节点的path属性指定访 ...

  9. struts2.xml的配置与技巧

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-/ ...

随机推荐

  1. HiveQL与SQL区别

    转自:http://www.aboutyun.com/thread-7327-1-1.html 1.Hive不支持等值连接 SQL中对两表内联可以写成:select * from dual a,dua ...

  2. IT工程师值得一看的书籍

    http://blog.csdn.net/chinahuyong/article/details/45060203

  3. mysql中判断表中是否存在某条记录

    SELECT CASE WHEN EXISTS (SELECT * FROM usergroupmap WHERE groupId = groupIdIn AND userId = v_friendI ...

  4. java附件上传下载磁盘版

    ACTION public class UploadAction extends BaseAction { private static final long serialVersionUID = 1 ...

  5. scanf(),gets(),gechar()函数小结

    1. 使用scanf()函数从终端输入字符串时,刚开始输入的所有空格不计入当前字符串,以 space,enter,tab键结束当前字符串的输入:最后的space,enter,tab字符会留在输入缓冲区 ...

  6. SeaJS 简单试用

    http://seajs.org/docs/#quick-start 感觉seajs的语法有点罗嗦... 它既有RequireJS的特点也有NodeJS引入模块的特点 例子是抄的官方的例子  在官方的 ...

  7. 一步一步学数据结构之1--n(通用树)

    今天来看大家介绍树,树是一种非线性的数据结构,树是由n个结点组成的有限集合,如果n=0,称为空树:如果n>0,则:有一个特定的称之为根的结点,它只有直接后继,但没有直接前驱:除根以外的其他结点划 ...

  8. 封装的localstorge的插件,store.js

    封装的localstorge的插件,store.js https://github.com/marcuswestin/store.js/

  9. Git库文件的状态

    git库所在的文件夹(即.git所在的文件夹)中的文件的状态: (1)untracked:未跟踪,此文件在文件夹中,但并没有加入git库,不参与版本控制. 通过”git add”,”git commi ...

  10. 编译器DIY——词法分析

    在上一篇文章中已经介绍了读文件的操作,那么这一篇文章中将会细致解释词法分析. 在源文件里解析出的单词流必须识别为保留字,标识符,常量,操作符和界符五大类 1.显然我们须要列举出全部的保留字,而这里与保 ...