其步骤如下:
**********常用的开发配置 stringMVC********************
在springMVC-servlet.xml中配置
<!-- 配置controller映射 最方便的方法,也是最常用的开发方法 -->
<context:component-scan base-package="com.tgb.web.controller"></context:component-scan>
<mvc:annotation-driven/>
然后再Controller中
@Controller //注入
public class welloController {
@RequestMapping({"/hello","/"})
public ModelAndView hello(){
Map<String, Object> map=new HashMap<String, Object>();
map.put("1", "1111111");
map.put("2", "2222222222");