尽管通过enumerois示例,我仍然无法发现面临的问题! 对此事的任何帮助都将是很好的帮助。
得到的错误是" 在DispatcherServlet中找不到带有URI [/ PMDBWebReport / pmdb /]的HTTP请求的映射,名称为' PMDBReportsDispatcher'
不确定在这里做错了什么.. !!我的规格是这样的。
第一个Web.xml
<servlet>
<servlet-name>PMDBReportsDispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextClass</param-name>
<param-value>
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
</param-value>
</init-param>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/PMDBReportsDispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>PMDBReportsDispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
我的PMDBReportsDispatcher-servlet.xml
<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix">
<value>/WEB-INF/views/viewonly/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
控制器代码
@Controller
公共类SummaryReportsController {
@RequestMapping(value="/pmdb")
public ModelAndView test(HttpServletResponse response) throws IOException{
System.out.println("Am inside SummaryReportsController....");
return new ModelAndView("index");
}
}
![ ]
答案 0 :(得分:0)
更改您的请求映射并在上下文路径中添加*,如下所示:
<servlet-mapping>
<servlet-name>PMDBReportsDispatcher</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>