简体   繁体   English

Java Struts2 操作 map 问题

[英]Java Struts2 Action map issue

I am new to struts2 and trying to learn very awesome struts2 framework.我是 struts2 的新手,并试图学习非常棒的 struts2 框架。

But I am stucked to a very critical issue as mentioned: There is no Action mapped for namespace / and action name Struts2Example1.但是我被提到的一个非常关键的问题困住了: There is no Action mapped for namespace / and action name Struts2Example1.

I am using IntelliJ IDE and the content of my web.xml is:我正在使用 IntelliJ IDE 和我的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"
         id="WebApp_ID"
         version="2.5">

    <display-name>Struts2Example2</display-name>

    <filter>
        <filter-name>struts2</filter-name>
        <!--<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>-->
        <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>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>

struts.xml 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>
</struts>

Can anybody help me to get rid of this error.任何人都可以帮助我摆脱这个错误。

Thanks谢谢

The best way to learn a new framework is to download some sample applications from the struts2 official website, check them how they are configured and how they are running Download Example Applications:学习新框架的最佳方法是从 struts2 官网下载一些示例应用程序,检查它们的配置方式和运行方式下载示例应用程序:

And what you have described in your query it seems there is some mapping issues with your config file more over the struts.xml file you have provided do not include any mapping entry, so its always better to provide complete details您在查询中描述的内容似乎与您的配置文件相比存在一些映射问题,而不是您提供的 struts.xml 文件不包含任何映射条目,因此最好提供完整的详细信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM