3. März 2017 07.06.58 org.springframework.web.servlet.PageNotFound noHandlerFound ACHTUNG: Keine Zuordnung für HTTP-Anforderung mit URI [/ SpringTest/add] in DispatcherServlet mit dem Namen 'telusuko'
Anrufen aus diesem
http://localhost:8085/SpringTest/index.jsp url funktioniert gut.
http://localhost:8085/SpringTest/add?t1=dfvd&t2=vdfvfd nicht funktioniert 404 Fehler bekommen
AddController:
package com.springs;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class AddController {
@RequestMapping(value="/add")
public String add(){
return "display.jsp";
//System.out.println("work");
}
}
telusuko-servlet.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:ctx="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd ">
<ctx:annotation-config></ctx:annotation-config>
<ctx:component-scan base-package="com.springs"></ctx:component-scan>
</beans>
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>
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>telusuko</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>telusuko</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
index.jsp:
<html>
<body>
<h2>Hello World!</h2>
<form action="add">
<input type="text" name="t1" />
<input type="text" name="t2" />
<input type="submit" />
</form>
</body>
</html>
Keine Verwendung andere Vorschläge zu erstellen? – srinivas
Versuchen Sie, ". Jsp" aus der Rückkehr zu entfernen und drucken Sie auf den Kommentar die URL nach dem Senden – OEH
Ich wurde geschrieben und versuchte mit system.out.println statt JSP-Datei sogar nicht funktioniert. DispatcherServlet kann keine konfigurierte Klasse mit @Controller finden – srinivas