Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions spring-mvc-forms-jsp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
- [MaxUploadSizeExceededException in Spring](http://www.baeldung.com/spring-maxuploadsizeexceeded)
- [Getting Started with Forms in Spring MVC](http://www.baeldung.com/spring-mvc-form-tutorial)
- [Form Validation with AngularJS and Spring MVC](http://www.baeldung.com/validation-angularjs-spring-mvc)
- [Guide to JSTL](http://www.baeldung.com/guide-to-jstl)
21 changes: 19 additions & 2 deletions spring-mvc-forms-jsp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
<version>${jstl.version}</version>
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>6.0.6</version>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
Expand All @@ -66,6 +72,7 @@
<version>${jackson.version}</version>
</dependency>


</dependencies>
<profiles>
<!-- Local -->
Expand Down Expand Up @@ -97,16 +104,26 @@
</profile>
</profiles>

<repositories>
<repository>
<id>1</id>
<name>jstl</name>
<url>https://mvnrepository.com/artifact/javax.servlet/jstl</url>
</repository>
</repositories>

<properties>
<springframework.version>4.3.7.RELEASE</springframework.version>
<maven-war-plugin.version>2.6</maven-war-plugin.version>
<jstl.version>1.2</jstl.version>
<javax.servlet.jsp-api.version>2.3.1</javax.servlet.jsp-api.version>
<javax.servlet-api.version>3.1.0</javax.servlet-api.version>
<hibernate-validator.version>5.4.0.Final</hibernate-validator.version>
<deploy-path>enter-location-of-server</deploy-path>
<deploy-path>server default deploy directory</deploy-path>
<fileupload.version>1.3.2</fileupload.version>
<jackson.version>2.8.7</jackson.version>
<jackson.version>2.8.7</jackson.version><!-- persistence -->
<hibernate.version>5.2.5.Final</hibernate.version>
<mysql-connector-java.version>5.1.40</mysql-connector-java.version>
</properties>

</project>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public ModelAndView sqlTags(final Model model) {

@RequestMapping(value = "/xml_tags", method = RequestMethod.GET)
public ModelAndView xmlTags(final Model model) {
System.out.println("dddddddddddddddddffffffffffffff");
ModelAndView mv = new ModelAndView("xml_tags");
return mv;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,42 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.web.multipart.MultipartResolver;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

@Configuration
@EnableWebMvc
@ComponentScan(basePackages = "com.baeldung.springmvcforms")
@ComponentScan(basePackages = {"com.baeldung.springmvcforms", "com.baeldung.jstl"})
class ApplicationConfiguration extends WebMvcConfigurerAdapter {

@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
configurer.enable();
}

@Bean
public ResourceBundleMessageSource resourceBundleMessageSource() {
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasename("messages");
return messageSource;
}

// switch orders to server views from html over views directory

@Bean
public InternalResourceViewResolver jspViewResolver() {
InternalResourceViewResolver bean = new InternalResourceViewResolver();
bean.setPrefix("/WEB-INF/views/");
bean.setSuffix(".jsp");
bean.setOrder(1);
return bean;
}


@Bean
public InternalResourceViewResolver htmlViewResolver() {
Expand Down
1 change: 0 additions & 1 deletion spring-mvc-xml/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Geolocation by IP in Java](http://www.baeldung.com/geolocation-by-ip-with-maxmind)
- [Guide to JavaServer Pages (JSP)](http://www.baeldung.com/jsp)
- [Exploring SpringMVC’s Form Tag Library](http://www.baeldung.com/spring-mvc-form-tags)
- [Guide to JSTL](http://www.baeldung.com/guide-to-jstl)
6 changes: 0 additions & 6 deletions spring-mvc-xml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@
<version>${hibernate-validator.version}</version>
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>6.0.6</version>
</dependency>


<!-- Json conversion -->
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion spring-mvc-xml/src/main/resources/webMvcConfig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</mvc:message-converters>
</mvc:annotation-driven>

<context:component-scan base-package="com.baeldung.spring.controller, com.baeldung.jstl.controllers"/>
<context:component-scan base-package="com.baeldung.spring.controller"/>

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/view/"/>
Expand Down
2 changes: 1 addition & 1 deletion spring-mvc-xml/src/main/webapp/WEB-INF/mvc-servlet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">


<context:component-scan base-package="com.baeldung.spring.controller, com.baeldung.jstl.controllers"/>
<context:component-scan base-package="com.baeldung.spring.controller"/>

<!-- Start: Mapping by bean name (BeanNameUrlHandlerMapping) -->
<bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping">
Expand Down