Add JSTL to JSP sample

pull/138/head
Dave Syer 11 years ago
parent f4f668a52b
commit 3f1cfbf241

@ -211,16 +211,6 @@
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>gradle</id>
<url>http://repo.gradle.org/gradle/libs-releases-local</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<build>
<pluginManagement>

@ -22,6 +22,10 @@
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
</dependencies>
<build>
<plugins>

@ -1,5 +1,8 @@
package org.springframework.boot.sample.jsp;
import java.util.Date;
import java.util.Map;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ -7,7 +10,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
public class WelcomeController {
@RequestMapping("/")
public String welcome() {
public String welcome(Map<String,Object> model) {
model.put("time", new Date());
return "welcome";
}

@ -1,12 +1,16 @@
<!DOCTYPE html>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html lang="en">
<body>
<c:url value="/resources/text.txt" var="url"/>
<spring:url value="/resources/text.txt" htmlEscape="true" var="springUrl" />
${springUrl}
Spring URL: ${springUrl} at ${time}
<br>
JSTL URL: ${url}
</body>
</html>

@ -68,4 +68,16 @@
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>gradle</id>
<url>http://repo.gradle.org/gradle/libs-releases-local</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project>

Loading…
Cancel
Save