你的位置:首页 > 软件开发 > Java > 第十八章 springboot + thymeleaf

第十八章 springboot + thymeleaf

发布时间:2016-05-17 22:00:08
代码结构:1、ThymeleafController 1 package com.xxx.firstboot.web; 2 3 import org.springframework.stereotype.Controller; 4 import org.springframew ...

第十八章 springboot + thymeleaf

代码结构:

第十八章 springboot + thymeleaf

1、ThymeleafController

第十八章 springboot + thymeleaf第十八章 springboot + thymeleaf
 1 package com.xxx.firstboot.web; 2  3 import org.springframework.stereotype.Controller; 4 import org.springframework.ui.Model; 5 import org.springframework.web.bind.annotation.RequestMapping; 6 import org.springframework.web.bind.annotation.RequestMethod; 7 import org.springframework.web.bind.annotation.RequestParam; 8 import org.springframework.web.bind.annotation.ResponseBody; 9 10 import io.swagger.annotations.Api;11 import io.swagger.annotations.ApiOperation;12 13 @Api("测试Thymeleaf和devtools")14 @Controller15 @RequestMapping("/thymeleaf")16 public class ThymeleafController {17 18   @ApiOperation("第一个thymeleaf程序")19   @RequestMapping(value = "/greeting", method = RequestMethod.GET)20   public String greeting(@RequestParam(name = "name", required = false, defaultValue = "world") String name,21               Model model) {22     model.addAttribute("xname", name);23     return "index";24   }25 26   @ApiOperation("thymeleaf ajax")27   @ResponseBody28   @RequestMapping(value = "/ajax", method = RequestMethod.GET)29   public String ajax(@RequestParam("username") String username) {30     return username;31   }32 33 }

 

海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com

原标题:第十八章 springboot + thymeleaf

关键词:Spring

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录