【问题标题】:struts2 + SPRING MVC + Rest Api integration . Struts not workingstruts2 + SPRING MVC + Rest Api 集成。支柱不工作
【发布时间】:2019-10-15 13:43:33
【问题描述】:
<?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/javaeehttp://java.sun.com/xml/ns/javaee/web-app_4_0.xsd" version="4.0">
    <absolute-ordering />
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>*.action</url-pattern>
    </filter-mapping>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:appContext.xml</param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener
                </listener-class>
    </listener>
    <servlet>
        <servlet-name>springrest</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet
                </servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:springrest-servlet.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>springrest</servlet-name>
        <url-pattern>/springrest/*</url-pattern>
    </servlet-mapping>
</web-app>

Rest api 运行良好我尝试使用邮递员。但是当我运行我的应用程序时,没有调用 struts 操作,并且每当我在 web.xml 中使用 servlets 标记时,struts2 都无法正常工作。

【问题讨论】:

标签: spring rest spring-mvc struts2


【解决方案1】:

我的错误是我参与了 struts-conventionstruts-json 插件。

我正在将 REST api 与 Spring 集成。但是struts会调用action。因为在 pom.xml 中涉及这两个插件。引发的错误。

谢谢

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-03
    • 1970-01-01
    • 2016-06-09
    • 2013-12-07
    • 2020-10-24
    • 1970-01-01
    • 2019-11-14
    • 2012-12-29
    相关资源
    最近更新 更多