java - 找不到操作或结果

标签 java configuration struts2 struts-action action-mapping

我得到:

com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn Could not find action or result There is no Action mapped for namespace [/] and action name [] associated with context path [/]. - [unknown location]

我结合使用 RAD + WebSphere 进行开发,代码如下:

struts.xml:

<struts>
    <constant name="struts.devMode" value="true" />
    <constant name="struts.custom.i18n.resources" value="ApplicationResources" />
    <package name="default" extends="struts-default" namespace="/">

web.xml:

<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>
<welcome-file-list>
    <welcome-file>Login.jsp</welcome-file>
</welcome-file-list>

我已经阅读了所有博客并尝试了网站上提到的所有内容。这是一个错误,因为我无法找到的某些不同原因。

最佳答案

操作名称 [] 和命名空间 [/] 没有配置。这是个问题。要解决这个问题,您应该添加一个配置。假设您在根文件夹中有一个 index.jsp 文件。使用无操作结果,您可以重定向到此页面。

<package name="default" extends="struts-default" namespace="/">
   <action name=""><result>/index.jsp</result></action> 
   ...

关于java - 找不到操作或结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30932742/

相关文章:

logging - 将事件日志条目保存到 Windows Azure 存储

java - Struts2 <s :select/> and a list of HashMap

java - 在 java webapp 中哪里放置可写属性文件?

java - Spring Batch @Primary 注释覆盖不正确的 bean

java - 使用 Java Normalizer 将口音 ascii 转换为非口音但排除某些符号

java - 有完整的eclipse包吗?

java - 运行使用 gradle 构建的 jar 时无法找到或加载主类

java - 控制台上的 log4j 信息

angular - 我在哪里声明 Angular 8.x 中 SASS 文件的加载路径?

ajax - 防止在 Struts 2 中重新加载页面