@Controller
@RequestMapping("/index")
public class IndexRpc extends MultiActionController {
@RequestMapping(value = "toIndex", method = RequestMethod.GET)
public String projectIndex(Model model, HttpServletRequest request,
HttpServletResponse response,HttpSession session) {
return "view/index";
}
}
这是一个springMVC类和方法,使用域名:http://www.xx.com/index/toIndex 可以访问首页 但如何使用:http://www.xx.com 访问首页呢?谢谢
@Controller
@RequestMapping("/")
public class IndexRpc extends MultiActionController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String projectIndex(Model model, HttpServletRequest request,
HttpServletResponse response,HttpSession session) {
return "view/index";
}
}
@Controller
@RequestMapping("/")
public class IndexRpc extends MultiActionController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String projectIndex(Model model, HttpServletRequest request,
HttpServletResponse response,HttpSession session) {
return "view/index";
}
}
将这个页面访问地址放到web.xml中的welcome-file-list欢迎页面中不行吗
写一个拦截器,拦截请求并转发到你想要跳转的请求就可以了