指定返回的視圖頁面名稱,結合設置的返回地址路徑加上頁面名稱后綴即可訪問到。
注意:如果方法聲明了注解@ResponseBody ,則會直接將返回值輸出到頁面。
@RequestMapping(value="/showdog")
public String hello1(){
return "hello";
}
@RequestMapping(value="/print")
@ResponseBody
public String print(){
String message = "Hello World, Spring MVC!";
return message;
}