Python语言技术文档

微信小程序技术文档

php语言技术文档

jsp语言技术文档

asp语言技术文档

C#/.NET语言技术文档

html5/css技术文档

javascript

点击排行

您现在的位置:首页 > 技术文档 > MVC/.NET框架

spring_mvc整合freemarker基于注解方式

来源:中文源码网    浏览:156 次    日期:2024-05-03 18:29:27
【下载文档:  spring_mvc整合freemarker基于注解方式.txt 】


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

相关内容