Spring MultiActionController不再接收请求?
我试图对我的控制器进行更改,突然间,我似乎不再收到任何请求(当尝试点击servlet映射的URL时为404)。我肯定我已经破坏了我的Spring MultiActionController不再接收请求?,spring,spring-mvc,controller,tomcat6,Spring,Spring Mvc,Controller,Tomcat6,我试图对我的控制器进行更改,突然间,我似乎不再收到任何请求(当尝试点击servlet映射的URL时为404)。我肯定我已经破坏了我的web.xml或appservlet.xml,但我不知道在哪里。我可以从tomcat(http://IP/app/index.jsp),但我无法使servlet映射正常工作 帮忙 web.xml: <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3/
web.xml
或appservlet.xml
,但我不知道在哪里。我可以从tomcat(http://IP/app/index.jsp
),但我无法使servlet映射正常工作
帮忙
web.xml:
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app version = "2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>app</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servet-mapping>
<servlet-name>app</servlet-name>
<url-pattern>/myRequest</url-pattern>
</servet-mapping>
org.springframework.web.context.ContextLoaderListener
应用程序
org.springframework.web.servlet.DispatcherServlet
应用程序
/我的请求
app-servlet.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id = "MyController" class = "com.stefankendall.MyController" ></bean>
<bean id="urlMappingDeployment" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/myRequest">MyController</prop>
</props>
</property>
</bean>
</beans>
霉菌控制者
/myRequest
应该是/myRequest/*
首先,您的控制器映射应该更像这样,但是您的URL“模式”看起来也很可疑,模式很少是静态字符串,但如果您想要的是映射到控制器的URL“/myRequest”,那么您只需要以下内容:
<bean name = "/myRequest" class = "com.stefankendall.MyController" ></bean>
请提供更多详细信息,据我所知,您没有页面,这将为您提供404。您没有指定欢迎页面,并且您只将该控制器映射到名称“/myRequest”,只有该特定URL甚至会发送到app-servlet.xml。当你转到你的站点/myRequest时,你想完成什么?这是一个简单的web服务。我只是在测试一个概念。我只需要那个URL被传递,是的。