技术分享
12345678910111213141516171819202122232425
│ ├─java│ └─com│ └─kreedx│ └─alishop│ │ Boot.java│ │ │ ├─utils│ │ AliShop.java│ │ │ └─web│ FreeMakerTest.java│ Test.java│ ├─resources│ │ application.properties│ │ │ ├─templates│ │ test.html│ │ │ └─templates2│ test.ftl│ └─webapp └─WEB-INF
1234567891011121314151617181920
server.port=8080server.session-timeout=30server.tomcat.uri-encoding=UTF-8spring.thymeleaf.prefix=classpath:templates/spring.thymeleaf.suffix=.htmlspring.thymeleaf.mode=HTML5spring.thymeleaf.encoding=UTF-8spring.thymeleaf.content-type=text/html spring.thymeleaf.cache=falselogging.file=log.log logging.level.com.xiaofangtech.sunt.controller = debug logging.level.com.xiaofangtech.sunt.helper = warnspring.freemarker.template-loader-path=classpath:/templates2/spring.mvc.static-path-pattern=/static/**
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.kreedx</groupId> <artifactId>Alipay</artifactId> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <name>Alipay Maven Webapp</name> <url>http://maven.apache.org</url> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.6.RELEASE</version> <relativePath /> <!-- lookup parent from repository --> </parent> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.alipay</groupId> <artifactId>alipy-sdk</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.1.1</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-freemarker</artifactId> <version>1.4.1.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> </dependencies> <build> <finalName>Alipay</finalName> </build></project>
1234567891011121314151617
@RequestMapping("free")@Controllerpublic class FreeMakerTest { @RequestMapping("/") public String helloHtml(Map<String, Object> map) { map.put("hello", "from TemplateController.helloHtml"); return "/test"; } @RequestMapping("/test") public String getTest(Model model){ model.addAttribute("name", "kreedx"); return "/test"; }}