一: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. 笔记-AndroidStudio开发环境的搭建

    首先当然是下载AndroidStudio,目前最新的稳定版是1.1 然后下载studio版本的sdk,如果用原装sdk,需要更新   安装的过程中会选择sdk的路径,此时如果已经解压了原装sdk,会进 ...

  2. adb wifi连接手机

    1. 默认情况下,ADB是通过USB来进行连接的. 不需要USB线,直接在android设备上安装一个超级终端,在终端里运行以下代码即可: su setprop service.adb.tcp.por ...

  3. wecenter—开启CURL扩展,让服务器支持PHP curl函数(远程采集)

    curl().file_get_contents().snoopy.class.php这三个远程页面抓取或采集中用到的工具, 默迹还是侵向于用snoopy.class.php,因为他效率比较高且不需要 ...

  4. C# Excel或表格插件

    NOPI好像比较好用对WINFORM支持更好! http://www.cnblogs.com/dreamof/archive/2010/06/02/1750151.html NOPI教程 http:/ ...

  5. 解决magento保存产品时耗时很长的问题

    以前我在更新产品属性值(拿price为例)的时候,通常会这样做: foreach($product_ids as $id){ $product = Mage::getModel('catalog/pr ...

  6. Azure SQL 数据库引入了新的服务级别

     新的级别将提升客户体验,并提供更多的业务连续性选项 为了更好地满足您在灵活性提升方面的需求,MicrosoftAzure SQL 数据库添加了新的服务级别(基础级和标准级),以与当前处于预览状态 ...

  7. HDU 5730 Shell Necklace(CDQ分治+FFT)

    [题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=5730 [题目大意] 给出一个数组w,表示不同长度的字段的权值,比如w[3]=5表示如果字段长度为3 ...

  8. java常用日期函数总结

    请记得要引入java.util.Date和java.text.SimpleDateFormat两个包 1.计算某一月份的最大天数 Calendar time=Calendar.getInstance( ...

  9. PendingIntent详解

    Intent是一个意图,一个描述了想要启动一个Activity.Broadcast或是Service的意图.它主要持有的信息是它想要启动的组件(Activity.Broadcast或是Service) ...

  10. 不允许在单例对象中创建Srping容器

    spring.net在使用的时候,不允许在单例对象中创建Srping容器 需要将实例化模式转为单例singleton=“false”