spring mvc整合freemarker基于注解方式 基于网络改进为:最正常版本复制代码 代码如下: 0 UTF-8 0.########## yyyy-MM-dd HH:mm:ss true ignore Controller建立复制代码 代码如下:import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; @Controller public class SpringMvcController { @RequestMapping(value="/welcome",method={RequestMethod.GET}) public ModelAndView getFirstPage(HttpServletRequest request) { //welcom就是视图的名称(welcom.ftl) ModelAndView mv = new ModelAndView("welcom"); mv.addObject("name", "My First Spring Mvc"); return mv; } } 在url上敲http://localhost:8080/welcome就会到WEB-INF/view/welcom.ftl页面渲染数据welcom.ftl页面复制代码 代码如下: Insert title here Hello ${name} 页面出来的效果: Hello My First Spring Mvc