一: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. ubuntu下浏览器调用本地应用程序

    ubunut下浏览器调用本地应用程序需要desktop文件和scheme协议的支持,和windows 的url protocol类似,只是注册协议的方式不一样. 首先是desktop文件,里面需要加入 ...

  2. VC++学习之GDI概述

    VC++学习之GDI概述 图形设备接口(GDI)是一个可执行程序,它接受Windows应用程序的绘图请求(表现为GDI函数调用),并将它们传给相应的设备驱动程序,完成特定于硬件的输出,象打印机输出和屏 ...

  3. JSON.parse这个是啥?

    var jsontext = '{"firstname":"Jesper","surname":"Aaberg",&qu ...

  4. js中this的四种使用方法

    0x00:js中this的四种调用模式 1,方法调用模式 2,函数调用模式 3,构造器调用模式 4,apply.call.bind调用模式 0x01:第一种:方法调用模式 (也就是用.调用的)this ...

  5. MySQL Select 优化

    准备: create table t(x int primary key,y int unique,z int); insert into t(x,y,z) values(1,1,1),(2,2,2) ...

  6. underscore api 概览

    underscore 集合函数(数组或对象) _.each(list, iteratee, [context]); _.map(list, iteratee, [context]); _.reduce ...

  7. Socket编程指南及示例程序

    例子代码就在我的博客中,包括六个UDP和TCP发送接受的cpp文件,一个基于MFC的局域网聊天小工具工程,和此小工具的所有运行时库.资源和执行程序.代码的压缩包位置是http://www.blogja ...

  8. 【Perl学习笔记】2. perl中的bless理解

    bless有两个参数:对象的引用.类的名称. 类的名称是一个字符串,代表了类的类型信息,这是理解bless的关键. 所谓bless就是把 类型信息 赋予 实例变量. 程序包括5个文件:person.p ...

  9. CodeForces 22C System Administrator

    把v和2结点交换, 1和v连,其它点和v之间能够互相连. #include <iostream> #include <cstdlib> #include <cstring ...

  10. Android studio 开发在真机测试

    真机测试 首先按照这设置android studio:   http://jingyan.baidu.com/article/fea4511a75d627f7ba912540.html 2.打开and ...