Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/358.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Struts2约定插件不扫描动作类_Java_Jsp_Struts2_Struts2 Convention Plugin - Fatal编程技术网

Java Struts2约定插件不扫描动作类

Java Struts2约定插件不扫描动作类,java,jsp,struts2,struts2-convention-plugin,Java,Jsp,Struts2,Struts2 Convention Plugin,项目结构 web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee h

项目结构

web.xml

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

    <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>

</web-app>
hello-world.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Hello World JSP</title>
</head>
<body>

This is message ${message}

</body>
</html>
当我链接到/hello world时,我只看到这是消息文本,但没有${message}的值。此外,控制台不会按System.out.println显示消息。因此,HelloWorldAction不调用。我做错了什么? 另外,我正在使用struts2-convention-plugin-2.3.16.3


在封堵log4j并查看日志后,该故障得以解决。我的类路径中没有asm库。

您确定它没有通过操作吗?在那里放一个日志,然后检查一下。另外,请尝试在JSP中使用此is消息,方法是添加JSP指令以将s前缀与JSP顶部的struts标记相匹配。我的类路径中没有asm库,因此它不起作用。非常感谢@AndreaLigios提供有关日志记录的提示。很高兴这对@MarkHunt有所帮助
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Hello World JSP</title>
</head>
<body>

This is message ${message}

</body>
</html>