Java Spring默认页面未通过控制器类
在mvc-view-config.xml中,我有Java Spring默认页面未通过控制器类,java,spring,jsp,spring-mvc,Java,Spring,Jsp,Spring Mvc,在mvc-view-config.xml中,我有,在Controller中,我有下面的代码。其思想是在首次加载站点时加载countrys/countryList.jsp。问题是它显示的是正确的jsp页面,但代码没有在控制器类中调用这个showCountryList()。但是如果我只做mysite.com/countrys或mysite.com/contrys/contryList,我也可以看到页面,代码调用showcontrylist()函数。我错过了什么 @RequestMapping(va
,在Controller中,我有下面的代码。其思想是在首次加载站点时加载countrys/countryList.jsp。问题是它显示的是正确的jsp页面,但代码没有在控制器类中调用这个showCountryList()。但是如果我只做mysite.com/countrys或mysite.com/contrys/contryList,我也可以看到页面,代码调用showcontrylist()函数。我错过了什么
@RequestMapping(value = {"/countrys", "/countrys/countryList"})
public String showCountryList(Map<String, Object> model) {
// Here we are returning an object of type 'Vets' rather than a collection of Vet objects
// so it is simpler for Object-Xml mapping
System.out.println("---- in here-----------");
Collection<Country> results = this.clinicService.getCountry();
model.put("selections", results);
return "countrys/countryList";
}
@RequestMapping(值={”/countrys“,“/countrys/countryList”})
公共字符串showCountryList(地图模型){
//在这里,我们返回的是“Vets”类型的对象,而不是Vet对象的集合
//因此,对象Xml映射更简单
System.out.println(“----在这里----------”;
收集结果=this.clinicService.getCountry();
模型。放置(“选择”,结果);
返回“国家/国家列表”;
}
此配置元素
<mvc:view-controller .../>
此外,“国家”的复数形式是“国家”
@RequestMapping(value = {"/", "/countrys", "/countrys/countryList"})