Skip to content
This repository was archived by the owner on Dec 15, 2021. It is now read-only.

Commit b3d5b07

Browse files
committed
Update project for SPR-7093
1 parent 79d8286 commit b3d5b07

File tree

9 files changed

+95
-71
lines changed

9 files changed

+95
-71
lines changed

SPR-7093/pom.xml

Lines changed: 19 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
<artifactId>spring-webmvc</artifactId>
4141
<version>${spring.version}</version>
4242
</dependency>
43+
<dependency>
44+
<groupId>org.springframework</groupId>
45+
<artifactId>spring-context-support</artifactId>
46+
<version>${spring.version}</version>
47+
</dependency>
4348

4449
<!-- CGLIB, required for @Configuration usage -->
4550
<dependency>
@@ -103,75 +108,33 @@
103108
</dependency>
104109

105110

106-
<!-- Apache Tiles
107111
<dependency>
108112
<groupId>org.apache.tiles</groupId>
109-
<artifactId>tiles-jsp</artifactId>
110-
<version>2.1.3</version>
111-
<exclusions>
112-
<exclusion>
113-
<groupId>commons-logging</groupId>
114-
<artifactId>commons-logging-api</artifactId>
115-
</exclusion>
116-
</exclusions>
113+
<artifactId>tiles-extras</artifactId>
114+
<version>3.0.3</version>
117115
</dependency>
118-
-->
119116

120-
<!-- JSR 303 with Hibernate Validator
121117
<dependency>
122-
<groupId>javax.validation</groupId>
123-
<artifactId>validation-api</artifactId>
124-
<version>1.0.0.GA</version>
118+
<groupId>org.apache.velocity</groupId>
119+
<artifactId>velocity</artifactId>
120+
<version>1.7</version>
125121
</dependency>
126122
<dependency>
127-
<groupId>org.hibernate</groupId>
128-
<artifactId>hibernate-validator</artifactId>
129-
<version>4.1.0.Final</version>
123+
<groupId>org.apache.velocity</groupId>
124+
<artifactId>velocity-tools</artifactId>
125+
<version>2.0</version>
130126
</dependency>
131-
-->
132127

133-
<!-- Joda Time Library
134128
<dependency>
135-
<groupId>joda-time</groupId>
136-
<artifactId>joda-time</artifactId>
137-
<version>1.6.2</version>
129+
<groupId>com.fasterxml.jackson.core</groupId>
130+
<artifactId>jackson-databind</artifactId>
131+
<version>2.4.1</version>
138132
</dependency>
139133
<dependency>
140-
<groupId>joda-time</groupId>
141-
<artifactId>joda-time-jsptags</artifactId>
142-
<version>1.0.2</version>
143-
<scope>runtime</scope>
144-
</dependency>
145-
-->
146-
147-
<!-- Apache Commons File Upload
148-
<dependency>
149-
<groupId>commons-fileupload</groupId>
150-
<artifactId>commons-fileupload</artifactId>
151-
<version>1.2.2</version>
152-
</dependency>
153-
<dependency>
154-
<groupId>commons-io</groupId>
155-
<artifactId>commons-io</artifactId>
156-
<version>2.0.1</version>
157-
</dependency>
158-
-->
159-
160-
<!-- Jackson JSON Processor
161-
<dependency>
162-
<groupId>org.codehaus.jackson</groupId>
163-
<artifactId>jackson-mapper-asl</artifactId>
164-
<version>1.8.1</version>
165-
</dependency>
166-
-->
167-
168-
<!-- Rome Atom+RSS
169-
<dependency>
170-
<groupId>rome</groupId>
171-
<artifactId>rome</artifactId>
172-
<version>1.0</version>
134+
<groupId>com.fasterxml.jackson.core</groupId>
135+
<artifactId>jackson-core</artifactId>
136+
<version>2.4.1</version>
173137
</dependency>
174-
-->
175138

176139
<!-- Test -->
177140
<dependency>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright 2002-2014 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.issues;
18+
19+
import org.springframework.stereotype.Controller;
20+
import org.springframework.ui.ModelMap;
21+
import org.springframework.web.bind.annotation.ModelAttribute;
22+
import org.springframework.web.bind.annotation.RequestMapping;
23+
import org.springframework.web.bind.annotation.RequestMethod;
24+
25+
@Controller
26+
public class SampleController {
27+
28+
@RequestMapping(value = "/", method = RequestMethod.GET)
29+
public String tiles(@ModelAttribute("model") ModelMap model) {
30+
model.addAttribute("hello", "Hello World!");
31+
return "index";
32+
}
33+
34+
}

SPR-7093/src/main/java/org/springframework/issues/config/WebConfig.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,21 @@
22

33
import org.springframework.context.annotation.ComponentScan;
44
import org.springframework.context.annotation.Configuration;
5-
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
6-
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
7-
import org.springframework.web.servlet.config.annotation.ViewResolutionRegistry;
8-
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
5+
import org.springframework.web.servlet.config.annotation.*;
6+
import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
97

108
@EnableWebMvc
119
@ComponentScan(basePackages="org.springframework.issues")
1210
@Configuration
1311
public class WebConfig extends WebMvcConfigurerAdapter {
1412

15-
@Override
16-
public void addViewControllers(ViewControllerRegistry registry) {
17-
registry.addViewController("/").setViewName("home");
18-
}
19-
2013
@Override
2114
public void configureViewResolution(ViewResolutionRegistry registry) {
22-
registry.jsp();
15+
//registry.jsp();
16+
//registry.freemarker();
17+
//registry.velocity();
18+
registry.tiles().definition("/WEB-INF/tiles.xml");
19+
//registry.contentNegotiating(new MappingJackson2JsonView());
2320
}
21+
2422
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<html>
2+
<body>
3+
${model.hello}
4+
</body>
5+
</html>
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
1+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
22
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
33
<html>
44
<head>
5-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6-
<title>Site</title>
5+
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6+
<title>My First Web Application Using Spring MVC</title>
77
</head>
88
<body>
9-
<h1>Home</h1>
9+
${model.hello}
1010
</body>
11-
</html>
11+
</html>
12+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<html>
2+
<body>
3+
${model.hello}
4+
</body>
5+
</html>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN" "http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
2+
3+
<tiles-definitions>
4+
5+
<definition name="index" template="/WEB-INF/tiles/template.jsp">
6+
<put-attribute name="body" value="/WEB-INF/tiles/index.jsp" />
7+
</definition>
8+
9+
</tiles-definitions>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
${model.hello}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
2+
<html>
3+
<body>
4+
<div id="body">
5+
<tiles:insertAttribute name="body" />
6+
</div>
7+
</body>
8+
</html>

0 commit comments

Comments
 (0)