的web.xml無法運行基本Spring MVC的例子 - 資源未找到
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spitter-servlet.xml</param-value>
</context-param>
<servlet>
<servlet-name>spitter</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>spitter</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
spitter-servlet.xml中
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<value>
/home=homeController
</value>
</property>
</bean>
<bean
class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="order" value="1"></property>
</bean>
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView"></property>
<property name="prefix" value="/WEB-INF/jsp/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
<bean name="homeController" class="org.SpringMvcExample.homeController"></bean>
homeController.java
public class homeController {
@RequestMapping({ "/", "/home" })
public String showHomePage(Map<String, Object> model) {
System.out.println("I am here");
model.put("spittles", new String("This is ramesh"));
return "home";
}
}
爲什麼我不能夠看到針對home.jsp?
回到Home.jsp被放置在路徑:WEB-INF/JSP /回到Home.jsp
我進入網址爲http://localhost:8080/SpringMvcExample/home.jsp
和錯誤是:未找到資源。
這裏有什麼錯?
請幫助我..
由於提前
任何建議球員......我認爲問題是與視圖解析器。但我找不到問題在哪裏?請解決這個問題 – javanoob 2010-09-19 04:39:27