-
大小: 195KB文件類型: .zip金幣: 2下載: 0 次發(fā)布日期: 2021-06-03
- 語言: 其他
- 標簽: springboot??velocity??maven??
資源簡介
SpringBoot1.4之后不再支持velocity,導(dǎo)致spring-boot-starter-velocity無法使用,本demo是SpringBoot1.5.x與velocity2集成demo,代碼是基于http://download.csdn.net/download/qq_30023773/10032465改的,原代碼是基于gradle的,并升級了springboot到目前最新的1.5.10

代碼片段和文件信息
package?com.example.demo;
import?org.springframework.stereotype.Controller;
import?org.springframework.ui.ModelMap;
import?org.springframework.web.bind.annotation.RequestMapping;
import?org.springframework.web.bind.annotation.ResponseBody;
import?org.springframework.web.servlet.ModelAndView;
import?javax.servlet.http.HttpServletRequest;
import?java.util.Map;
/**
?*?Created?by?Saber?on?2018/2/24?下午1:13
?*/
@Controller
@RequestMapping(“/“)
public?class?SpringBootTestController?{
????/**
?????*?首頁
?????*
?????*?@return
?????*/
????@RequestMapping(“/“)
????public?String?index(){
????????return?“index“;
????}
????/**
?????*?ajax?test
?????*
?????*?@param?request
?????*?@return
?????*/
????@RequestMapping(“/ajax“)
????@ResponseBody
????public?String?ajaxTest(HttpServletRequest?request)?{
????????return?“ajax?測試成功~“;
????}
????/**
?????*?頁面測試
?????*
?????*?@param?map
?????*?@return
?????*/
????@RequestMapping(“/welcome“)
????public?String?viewTest(Map?map)?{
????????map.put(“a“?“SpringBoot1.5.10+velocity?頁面測試1“);
????????return?“welcome“;
????}
????/**
?????*?頁面測試2
?????*
?????*?@return
?????*/
????@RequestMapping(“/welcome2“)
????public?ModelAndView?viewTest2()?{
????????ModelAndView?modelAndView?=?new?ModelAndView();
????????modelAndView.addobject(“a“?“SpringBoot1.5.10+velocity?頁面測試2“);
????????modelAndView.setViewName(“welcome“);
????????return?modelAndView;
????}
????/**
?????*?頁面測試3
?????*
?????*?@return
?????*/
????@RequestMapping(“/welcome3“)
????public?ModelAndView?viewTest3()?{
????????ModelMap?map?=?new?ModelMap();
????????map.put(“a“?“SpringBoot1.5.10+velocity?頁面測試3“);
????????return?new?ModelAndView(“view/welcome“?map);
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-02-24?16:44??SpringBoot15_10-velocity2\
?????文件????????6148??2018-02-24?16:54??SpringBoot15_10-velocity2\.DS_Store
?????目錄???????????0??2018-02-24?16:54??__MACOSX\
?????目錄???????????0??2018-02-24?16:54??__MACOSX\SpringBoot15_10-velocity2\
?????文件?????????120??2018-02-24?16:54??__MACOSX\SpringBoot15_10-velocity2\._.DS_Store
?????目錄???????????0??2018-02-24?16:54??SpringBoot15_10-velocity2\.git\
?????文件????????6148??2018-02-24?16:45??SpringBoot15_10-velocity2\.git\.DS_Store
?????目錄???????????0??2018-02-24?16:54??__MACOSX\SpringBoot15_10-velocity2\.git\
?????文件?????????120??2018-02-24?16:45??__MACOSX\SpringBoot15_10-velocity2\.git\._.DS_Store
?????目錄???????????0??2018-02-24?16:44??SpringBoot15_10-velocity2\.git\branches\
?????文件??????????15??2018-02-24?16:45??SpringBoot15_10-velocity2\.git\COMMIT_EDITMSG
?????文件?????????323??2018-02-24?16:45??SpringBoot15_10-velocity2\.git\config
?????文件??????????73??2018-02-24?16:44??SpringBoot15_10-velocity2\.git\desc
?????文件??????????23??2018-02-24?16:44??SpringBoot15_10-velocity2\.git\HEAD
?????目錄???????????0??2018-02-24?16:44??SpringBoot15_10-velocity2\.git\hooks\
?????文件?????????478??2018-02-24?16:44??SpringBoot15_10-velocity2\.git\hooks\applypatch-msg.sample
?????文件?????????896??2018-02-24?16:44??SpringBoot15_10-velocity2\.git\hooks\commit-msg.sample
?????文件?????????189??2018-02-24?16:44??SpringBoot15_10-velocity2\.git\hooks\post-update.sample
?????文件?????????424??2018-02-24?16:44??SpringBoot15_10-velocity2\.git\hooks\pre-applypatch.sample
?????文件????????1642??2018-02-24?16:44??SpringBoot15_10-velocity2\.git\hooks\pre-commit.sample
?????文件????????1348??2018-02-24?16:44??SpringBoot15_10-velocity2\.git\hooks\pre-push.sample
?????文件????????4951??2018-02-24?16:44??SpringBoot15_10-velocity2\.git\hooks\pre-reba
?????文件?????????544??2018-02-24?16:44??SpringBoot15_10-velocity2\.git\hooks\pre-receive.sample
?????文件????????1239??2018-02-24?16:44??SpringBoot15_10-velocity2\.git\hooks\prepare-commit-msg.sample
?????文件????????3610??2018-02-24?16:44??SpringBoot15_10-velocity2\.git\hooks\update.sample
?????文件????????2203??2018-02-24?16:45??SpringBoot15_10-velocity2\.git\index
?????目錄???????????0??2018-02-24?16:44??SpringBoot15_10-velocity2\.git\info\
?????文件?????????240??2018-02-24?16:44??SpringBoot15_10-velocity2\.git\info\exclude
?????目錄???????????0??2018-02-24?16:45??SpringBoot15_10-velocity2\.git\logs\
?????文件?????????158??2018-02-24?16:45??SpringBoot15_10-velocity2\.git\logs\HEAD
?????目錄???????????0??2018-02-24?16:45??SpringBoot15_10-velocity2\.git\logs\refs\
............此處省略206個文件信息
評論
共有 條評論