我試圖對我的控制器進行更改,突然之間,我似乎不再收到任何請求(嘗試訪問servlet映射URL時爲404)。我確定我打破了我的web.xml
或app-servlet.xml
,但我只是不知道在哪裏。我可以從tomcat(http://IP/app/index.jsp
)訪問index.jsp
,但我無法讓我的servlet映射正常工作。MultiActionController不再接收請求?
幫助?
的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>
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>
請包括更多的細節,從我看到你有沒有頁面,這會給你一個404。你沒有指定歡迎頁面,並且你已經將該控制器映射到名稱「/ myRequest」,只有該特定的URL甚至會被髮送到app-servlet.xml。當你去yoursite/myRequest時你想完成什麼? – walnutmon 2010-03-16 18:46:36
這是一個簡單的網絡服務。我只是在測試一個概念。我只需要該URL即可傳遞,是的。 – 2010-03-16 20:19:10