Skip to content

Commit 3c3089e

Browse files
ochejapivovarit
authored andcommitted
BAEL-1602 (eugenp#3963)
* Implement examples for ASCII Art in Java * Remove deprecated use of ControllerClassNameHandlerMapping * Implement examples for JSTL core tag * Implement examples for JSTL formatting tags * Implement examples for JSTL SQL tags * Implement examples for JSTL XML tags * Implement examples for JSTL function tags * Setup controllers package scanning * Add link to article on jstl * naming change * Add jstl maven repository * Migrate example codes for Guide to JSTL to spring-mvc-forms-jsp module * Add view resolver order to define priority * Remove guide to jstl example codes from spring-mvc-xml module * Remove guide to jstl examples in spring-mvc-xml module after merge * Update link to article
1 parent 64cadbf commit 3c3089e

18 files changed

Lines changed: 36 additions & 13 deletions

File tree

‎spring-mvc-forms-jsp/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
- [MaxUploadSizeExceededException in Spring](http://www.baeldung.com/spring-maxuploadsizeexceeded)
55
- [Getting Started with Forms in Spring MVC](http://www.baeldung.com/spring-mvc-form-tutorial)
66
- [Form Validation with AngularJS and Spring MVC](http://www.baeldung.com/validation-angularjs-spring-mvc)
7+
- [Guide to JSTL](http://www.baeldung.com/guide-to-jstl)

‎spring-mvc-forms-jsp/pom.xml‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
<version>${jstl.version}</version>
4949
</dependency>
5050

51+
<dependency>
52+
<groupId>mysql</groupId>
53+
<artifactId>mysql-connector-java</artifactId>
54+
<version>6.0.6</version>
55+
</dependency>
56+
5157
<dependency>
5258
<groupId>org.hibernate</groupId>
5359
<artifactId>hibernate-validator</artifactId>
@@ -66,6 +72,7 @@
6672
<version>${jackson.version}</version>
6773
</dependency>
6874

75+
6976
</dependencies>
7077
<profiles>
7178
<!-- Local -->
@@ -97,16 +104,26 @@
97104
</profile>
98105
</profiles>
99106

107+
<repositories>
108+
<repository>
109+
<id>1</id>
110+
<name>jstl</name>
111+
<url>https://mvnrepository.com/artifact/javax.servlet/jstl</url>
112+
</repository>
113+
</repositories>
114+
100115
<properties>
101116
<springframework.version>4.3.7.RELEASE</springframework.version>
102117
<maven-war-plugin.version>2.6</maven-war-plugin.version>
103118
<jstl.version>1.2</jstl.version>
104119
<javax.servlet.jsp-api.version>2.3.1</javax.servlet.jsp-api.version>
105120
<javax.servlet-api.version>3.1.0</javax.servlet-api.version>
106121
<hibernate-validator.version>5.4.0.Final</hibernate-validator.version>
107-
<deploy-path>enter-location-of-server</deploy-path>
122+
<deploy-path>server default deploy directory</deploy-path>
108123
<fileupload.version>1.3.2</fileupload.version>
109-
<jackson.version>2.8.7</jackson.version>
124+
<jackson.version>2.8.7</jackson.version><!-- persistence -->
125+
<hibernate.version>5.2.5.Final</hibernate.version>
126+
<mysql-connector-java.version>5.1.40</mysql-connector-java.version>
110127
</properties>
111128

112129
</project>

spring-mvc-xml/src/main/java/com/baeldung/jstl/bundles/CustomMessage_en.java renamed to spring-mvc-forms-jsp/src/main/java/com/baeldung/jstl/bundles/CustomMessage_en.java

File renamed without changes.

spring-mvc-xml/src/main/java/com/baeldung/jstl/bundles/CustomMessage_fr_FR.java renamed to spring-mvc-forms-jsp/src/main/java/com/baeldung/jstl/bundles/CustomMessage_fr_FR.java

File renamed without changes.

spring-mvc-xml/src/main/java/com/baeldung/jstl/controllers/JSTLController.java renamed to spring-mvc-forms-jsp/src/main/java/com/baeldung/jstl/controllers/JSTLController.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ public ModelAndView sqlTags(final Model model) {
9191

9292
@RequestMapping(value = "/xml_tags", method = RequestMethod.GET)
9393
public ModelAndView xmlTags(final Model model) {
94+
System.out.println("dddddddddddddddddffffffffffffff");
9495
ModelAndView mv = new ModelAndView("xml_tags");
9596
return mv;
9697
}

spring-mvc-xml/src/main/java/com/baeldung/jstl/dbaccess/SQLConnection.java renamed to spring-mvc-forms-jsp/src/main/java/com/baeldung/jstl/dbaccess/SQLConnection.java

File renamed without changes.

‎spring-mvc-forms-jsp/src/main/java/com/baeldung/springmvcforms/configuration/ApplicationConfiguration.java‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,42 @@
33
import org.springframework.context.annotation.Bean;
44
import org.springframework.context.annotation.ComponentScan;
55
import org.springframework.context.annotation.Configuration;
6+
import org.springframework.context.support.ResourceBundleMessageSource;
67
import org.springframework.web.multipart.MultipartResolver;
78
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
89
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
910
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
1011
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
12+
import org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping;
1113
import org.springframework.web.servlet.view.InternalResourceViewResolver;
1214

1315
@Configuration
1416
@EnableWebMvc
15-
@ComponentScan(basePackages = "com.baeldung.springmvcforms")
17+
@ComponentScan(basePackages = {"com.baeldung.springmvcforms", "com.baeldung.jstl"})
1618
class ApplicationConfiguration extends WebMvcConfigurerAdapter {
1719

1820
@Override
1921
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
2022
configurer.enable();
2123
}
2224

25+
@Bean
26+
public ResourceBundleMessageSource resourceBundleMessageSource() {
27+
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
28+
messageSource.setBasename("messages");
29+
return messageSource;
30+
}
31+
32+
// switch orders to server views from html over views directory
33+
2334
@Bean
2435
public InternalResourceViewResolver jspViewResolver() {
2536
InternalResourceViewResolver bean = new InternalResourceViewResolver();
2637
bean.setPrefix("/WEB-INF/views/");
2738
bean.setSuffix(".jsp");
39+
bean.setOrder(1);
2840
return bean;
2941
}
30-
3142

3243
@Bean
3344
public InternalResourceViewResolver htmlViewResolver() {
File renamed without changes.

spring-mvc-xml/src/main/webapp/WEB-INF/view/core_tags.jsp renamed to spring-mvc-forms-jsp/src/main/webapp/WEB-INF/views/core_tags.jsp

File renamed without changes.

spring-mvc-xml/src/main/webapp/WEB-INF/view/core_tags_redirect.jsp renamed to spring-mvc-forms-jsp/src/main/webapp/WEB-INF/views/core_tags_redirect.jsp

File renamed without changes.

0 commit comments

Comments
 (0)