Home » Author Archives: Jerome Versrynge (page 2)

Author Archives: Jerome Versrynge

Spring MVC REST Calls With Ajax

spring-interview-questions-answers

This post provides a simple example of REST calls to a Spring MVC web application. It is based on the Serving Static Resources With Spring MVC and Fetching JSON With Ajax In Spring MVC Context example. The code is  available on GitHub in the Spring-REST-With-Ajax directory. Main Page Our main page contains four buttons linked to Javascript functions performing Ajax calls:       ...

Read More »

Spring MVC Error Handling Example

spring-interview-questions-answers

This post describes the different techniques to perform error handling in Spring MVC 3. The code is available on GitHub in the Spring-MVC-Error-Handling directory. It is based on the Spring MVC With Annotations examples. Handling Exceptions Before Spring 3 Before Spring 3, exceptions were handled with HandlerExceptionResolvers. This interface defines a single method:       ModelAndView resolveException( HttpServletRequest request, HttpServletResponse response, Object ...

Read More »

Spring: Setting Logging Dependencies

spring-interview-questions-answers

This post describes how to set-up logging dependencies in Spring. It is based on information available in a post by Dave Syer’s. A reminder on Java logging frameworks is available here. The code example is available at GitHub in the Spring-Logging-Dependencies directory. Spring uses Jakarta Commons Logging API (JCL). Unfortunately, many people do not like its runtime discovery algorithm. We can disactivate it and ...

Read More »

Spring MVC Form Validation (With Annotations)

spring-interview-questions-answers

This post provides a simple example of a HTML form validation. It is based on the Spring MVC With Annotations example. The code is available on GitHub in the Spring-MVC-Form-Validation directory. Data For this example we will use a bean and JSR303 validation annotations:               public class MyUser { @NotNull @Size(min=1,max=20) private String name; @Min(0) @Max(120) private int ...

Read More »

Introduction To REST Concepts

software-development-2-logo

Introduction This post aims at demystifying the REST (Representational State Transfert) web design concepts. REST is based on a client server model. REST is a set of principles describing how standards can be used to develop web applications, for example. Its main purpose is to anticipate on common implementation issues and organize the relationship between logical clients and servers. You ...

Read More »

Spring MVC Customized User Login Logout Implementation Example

spring-security-logo

This post describes how to implement a customized user access to an Spring MVC web application (login logout). As a prerequisite, readers are advised to read this post which introduces several Spring Security concepts. The code example is available from Github in the Spring-MVC-Login-Logout directory. It is derived from the Spring MVC with annotations example. Customized Authentication Provider In order ...

Read More »

JUnit Testing Spring Service and DAO (with In-Memory Database)

spring-interview-questions-answers

This post describes how to implement JUnit tests for a Spring Web Application’s Services and DAO. It is built on top of the Spring MVC-Service-DAO-Persistence Architecture Example. This example is available from Github in the Spring-Web-JPA-Testing directory. Reminder Test Fixture – The fixed state used as a baseline for running tests. Unit test – These tests verify that pieces of ...

Read More »

Spring MVC Controller JUnit Testing

spring-interview-questions-answers

JUnit testing Spring MVC controllers is not an easy task. But recently, a new project (to be included in Spring soon) offers new tools to facilitate this. This post illustrates how to test a simple controller via JUnit tests. This code is a variation of the code used in JUnit Testing Spring Service and DAO (with In-Memory Database). It is ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.