首页 \ 问答 \ 没有为命名空间[/]和与上下文路径[/ struts]关联的动作名称[]映射的动作(There is no Action mapped for namespace [/] and action name [] associated with context path [/struts])

没有为命名空间[/]和与上下文路径[/ struts]关联的动作名称[]映射的动作(There is no Action mapped for namespace [/] and action name [] associated with context path [/struts])

我已经通过了所有类似的问题在stackoverflow但没有帮助,对不起。 我从他们所有人的主要区别是,我收到了错误消息中的EMPTY操作名称。 谷歌搜索没有帮助:(希望有人可以提供一个提示,在哪里寻找问题的根源

信息:

    Stacktraces
    There is no Action mapped for namespace [/] and action name [] associated with context path [/struts]. - [unknown location] 
        com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
        org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
        org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
        com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58
    ..................

struts.xml中:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

        <struts>
        <constant name="struts.devMode" value="true" />
        <package name="default" namespace="/*" extends="struts-default">
            <action name="login"
                class="training.struts.action.LoginAction">
                <result>login.jsp</result>
            </action>
        </package>
        </struts>

web.xml中:

        <?xml version="1.0" encoding="UTF-8"?>
        <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        version="2.5">

        <display-name>Struts Lab</display-name>

        <filter>
            <filter-name>struts2</filter-name>
            <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
        </filter>

        <filter-mapping>
            <filter-name>struts2</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>

        <!-- Spring Config -->
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>
                    /WEB-INF/springServlet/appServlet/mvc-servlet.xml,
                    /WEB-INF/db/db-cfg.xml,
                    /WEB-INF/springServlet/application-security.xml
            </param-value>
        </context-param>

        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>

        <servlet>
            <servlet-name>mvc</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <init-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>/WEB-INF/springServlet/appServlet/mvc-servlet.xml</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
        </servlet>

        <servlet-mapping>
            <servlet-name>mvc</servlet-name>
            <url-pattern>/</url-pattern>
        </servlet-mapping>

        <!-- Spring Security -->
        <filter>
            <filter-name>springSecurityFilterChain</filter-name>
            <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
        </filter>

        <filter-mapping>
            <filter-name>springSecurityFilterChain</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>

        <!-- *** -->
        <welcome-file-list>
            <welcome-file>login.jsp</welcome-file>
            <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>

        </web-app>

好..图像是不可能的,所以项目结构是:

src/main/java
----+training.struts.action.LoginAction.java
src/main/webapp
----+WEB-INF
--------+classes
-----------+struts.xml
--------+db
-----------+db-cfg.xml
--------+springServlet
-----------+appServlet
---------------+mvc-servlet.xml
-----------+application-security.xml
--------+index.jsp
--------+login.jsp
--------+web.xml

更新:很愚蠢=(我已经将我的login.jsp从WEB-INF移到了webapp root并解决了问题。

UPDATE2:我做了一些调查:如果从web.xml中删除“welcome-file-list”块,容器将在webapp root中查找“index.jsp”,以显示应用程序运行时的第一个视图。 如果我删除了“index.jsp”,那么我会得到相同的异常消息: 没有为命名空间[/]和与上下文路径[/ struts]关联的动作名称[]映射操作

所以在我看来,如果在错误消息中使用struts的正确xml设置的空操作名称,则第一步应该是启动JSP可用性检查。

干杯,伙计们。


I've looked through all similar Qs on stackoverflow but it didn't help, sorry. The main difference I have from all of them is that I got EMPTY action name in error message. Googling didn't help :( Hope someone just could give a hint where to look for the source of the problem. thx

message:

    Stacktraces
    There is no Action mapped for namespace [/] and action name [] associated with context path [/struts]. - [unknown location] 
        com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
        org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
        org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
        com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58
    ..................

struts.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

        <struts>
        <constant name="struts.devMode" value="true" />
        <package name="default" namespace="/*" extends="struts-default">
            <action name="login"
                class="training.struts.action.LoginAction">
                <result>login.jsp</result>
            </action>
        </package>
        </struts>

web.xml:

        <?xml version="1.0" encoding="UTF-8"?>
        <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        version="2.5">

        <display-name>Struts Lab</display-name>

        <filter>
            <filter-name>struts2</filter-name>
            <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
        </filter>

        <filter-mapping>
            <filter-name>struts2</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>

        <!-- Spring Config -->
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>
                    /WEB-INF/springServlet/appServlet/mvc-servlet.xml,
                    /WEB-INF/db/db-cfg.xml,
                    /WEB-INF/springServlet/application-security.xml
            </param-value>
        </context-param>

        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>

        <servlet>
            <servlet-name>mvc</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <init-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>/WEB-INF/springServlet/appServlet/mvc-servlet.xml</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
        </servlet>

        <servlet-mapping>
            <servlet-name>mvc</servlet-name>
            <url-pattern>/</url-pattern>
        </servlet-mapping>

        <!-- Spring Security -->
        <filter>
            <filter-name>springSecurityFilterChain</filter-name>
            <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
        </filter>

        <filter-mapping>
            <filter-name>springSecurityFilterChain</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>

        <!-- *** -->
        <welcome-file-list>
            <welcome-file>login.jsp</welcome-file>
            <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>

        </web-app>

well..image is impossible so the project structure is:

src/main/java
----+training.struts.action.LoginAction.java
src/main/webapp
----+WEB-INF
--------+classes
-----------+struts.xml
--------+db
-----------+db-cfg.xml
--------+springServlet
-----------+appServlet
---------------+mvc-servlet.xml
-----------+application-security.xml
--------+index.jsp
--------+login.jsp
--------+web.xml

UPDATE: So sad to be stupid =( I've moved my login.jsp from WEB-INF to webapp root and that solved the problem.

UPDATE2: I've made some investigation: if I remove "welcome-file-list" block from web.xml, container will look for "index.jsp" in webapp root to show as first view on application running. If I delete "index.jsp" then I'll got the identical exception message: There is no Action mapped for namespace [/] and action name [] associated with context path [/struts]

So in my opinion if you have empty action name in error message with correct xml settings for struts, the first step should be start-up JSP availability checking.

Cheers, guys.


原文:https://stackoverflow.com/questions/17829388
更新时间:2022-01-23 15:01

最满意答案

您没有指定返回哪个错误,我认为它与单引号有关。 您的INSERT可能在APPLY('INSERT ....;')中,您可以尝试使用两个单引号来获取字符串中的一个引号:

APPLY('insert into emp values ( COALESCE(:Fname,'' ''),....') 

或者在SELECT中执行此操作(此处不支持COALESCE):

SELECT
   CASE WHEN Fname IS NULL THEN ' ' ELSE Fname END AS Fname,
   ...
FROM OPERATOR

You didn't specify which error is returned, i assume it's related to the single quotes. Your INSERT is probably within an APPLY('INSERT ....;') you might try two single quotes to get one quote in a string:

APPLY('insert into emp values ( COALESCE(:Fname,'' ''),....') 

Or do it in the SELECT (COALESCE is not supported here):

SELECT
   CASE WHEN Fname IS NULL THEN ' ' ELSE Fname END AS Fname,
   ...
FROM OPERATOR

相关问答

更多
  • 您可以使用合成来为场景建模。 这可以使用共享主键映射进行配置,其中所有类都对应于唯一表。 public class Person { public int Id { get; set; } public string Name { get; set; } } public abstract class Role { public int PersonId { get; set; } public virtual Person Person { get; set; } } ...
  • 我建议更改EF模型设置并设置.HasOptional(t => t.Folder)。 EF行为真的很奇怪。 但是当您加载与文件夹相关的字母时,情况之间存在差异。 这里有一篇文章的链接,解释了这个差异使用级联删除 。 无论如何.HasOptional(t => t.Folder)应该解决问题。 你无法改变 public int FolderId {get; set;} 至 public int? FolderId {get; set;} 编辑: 如果HasOptional(t => t. ...
  • 你得到一个黑屏,因为你错误地实例化你的控制器。 此外,您不要使用pushViewController:animated:推送视图控制器,这是在调用performSegueWithIdentifier时为您完成的: 如果你在故事板中有segue设置,那么你应该实现prepareForSegue:sender:,而不是performSegueWithIdentifier:。 它的代码应如下所示: - (void)prepareForSegue:(UIStoryboardSegue *)segue sender: ...
  • 可能没有这样的选项可用。 你可以做的是编写一个连接到数据库并执行清理查询的shell脚本。 您可以将此脚本放入会话的失败命令任务选项中。 There is probably no such option readily available. What you can do is to write a shell script that would connect to the database and execute a cleanup query. You can put this script in s ...
  • 您没有指定返回哪个错误,我认为它与单引号有关。 您的INSERT可能在APPLY('INSERT ....;')中,您可以尝试使用两个单引号来获取字符串中的一个引号: APPLY('insert into emp values ( COALESCE(:Fname,'' ''),....') 或者在SELECT中执行此操作(此处不支持COALESCE): SELECT CASE WHEN Fname IS NULL THEN ' ' ELSE Fname END AS Fname, ... F ...
  • 衍生PK的副作用也是FK。 实体框架自动索引FK列。 这不是一个错误。 这不是过于聪明。 我认为。 我相信你可以删除第二个索引,因为它可以为你提供任何性能方面的东西。 It's a side-effect of the derived PK to be also the FK. Entity Framework automatically indexes FK columns. It's not a bug. It's just not being overly smart. I think. I beli ...
  • 当我想要的是实体框架时,实体框架添加所有外部连接的原因是什么。 EF希望知道实体的确切类型( Person , Customer , IndividualCustomer等),以便能够创建正确的实例。 因此,它只能从加入层次结构的所有表中获取类型信息(请参阅case语句)。 有没有解决方法来解决这个问题? 其中一种可能的替代方法是应用 - 只查询基类中所需的属性,就像您一样。 另一种可能的替代方法 - 使用带有鉴别器列的每层次表。 What is the reason that entity framewo ...
  • 尽管我已经重新启动Visual Studio几次以排除可能的intellisense / resharper没有正确加载可用方法,属性,一天后出现属性方法。 Despite the fact that I have restarted Visual Studio for a few times to exclude the possibility intellisense / resharper haven't load the available methods, properties correctly ...
  • 不同的方法呢? 而不是在快速加载中解决这个问题,而是将数据加载到临时表,如DATABASENAME.CITIES_TMP,其结构如下所示 City | zip_code | country | column4 xyz | 12 | Esp | NULL | abc | 12 | Por 在下一步中,使用结构创建目标表DATABASENAME.CITY City | zip_code | country | 作为最后一步,您需要运行2个INSERT查询: INS ...
  • 我不知道有任何工具会自动从TPT迁移到TPH,但您可以自己迁移数据作为数据库迁移的一部分。 从类中删除[Table]注释 使用“ Add-Migration命令生成新迁移。 生成的迁移将包含几个AddColumn , DropForeignKey , DropIndex , DropTable调用 将所有AddColumn调用放在Up方法的顶部 编写一个SQL命令,用于填充表中包含层次结构所有数据的新创建的列(不要忘记设置正确的Discriminator )。 UPDATE [TPHTable] SET [ ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。