Add @Value injection to JSP (WAR) sample

pull/176/head
Dave Syer 11 years ago
parent b694556483
commit d9e326a3d3

@ -3,15 +3,20 @@ package org.springframework.boot.sample.jsp;
import java.util.Date;
import java.util.Map;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class WelcomeController {
@Value("${application.message:Hello World}")
private String message = "Hello World";
@RequestMapping("/")
public String welcome(Map<String,Object> model) {
model.put("time", new Date());
model.put("message", message );
return "welcome";
}

@ -1,2 +1,3 @@
spring.view.prefix: /WEB-INF/jsp/
spring.view.suffix: .jsp
application.message: Hello Phil

@ -11,6 +11,8 @@
Spring URL: ${springUrl} at ${time}
<br>
JSTL URL: ${url}
<br>
Message: ${message}
</body>
</html>

Loading…
Cancel
Save