Tag: Web MVC

Spring 3 MVC – Adding Objects to a List element on the fly at form submit – (Generic method)

Spring 3 MVC – Adding Objects to a List element on the fly at form submit – (Generic method)

Edit 10-Feb-2015 A much better approach to this problem is simply to use JSON. A number of comments below are in regard to nested lists. The solution detailed here does not readily facilitate nested lists. The solution outlined in this blog does: http://outbottle.com/spring-4-web-mvc-json-handling/. JSON is the recommended way of achieving “Adding […]

Spring 3 Security – Custom Login Form with Remember Me

Spring 3 Security – Custom Login Form with Remember Me

This tutorial will demonstrate the following: Login with a custom login form (rather than the spring security default) Implement a remember me function Distinguish between being logged in via ‘Remember-Me’ versus Actually logged in

Permit CSS, JS and other resources in a Spring application

Permit CSS, JS and other resources in a Spring application

In Spring 3 Web MVC applications every request is sent through an @Controller method. This is undesirable for CSS, JS and image files. Overcome the problem as so.

Hello Spring 3 Security with Netbeans – Role Based Method Protection

Hello Spring 3 Security with Netbeans – Role Based Method Protection

This tutorial will outline in simple steps how to do the following: Create Spring 3 Web MVC project using Netbeans Introduce Spring Security measures Limit @Controller method invocation to certain User-Role’s using Annotations Roles and users are defined within XML configurations. The full source code is available for download here

Custom Annotated Validation with Spring 3 Web MVC

Custom Annotated Validation with Spring 3 Web MVC

My previous tutorial detailed using Hibernate Validation within Spring 3 Web MVC.  This tutorial shows how to create custom validation annotations. E.g.

This example annotation only permits the word ‘John’. Optionally, it can be case-sensitive. 

Spring 3 Web MVC – Exception Handling – incorporating AJAX

Spring 3 Web MVC – Exception Handling – incorporating AJAX

This tutorial demonstrates how to handle exceptions in Spring 3 Web MCV. Emphasis is given to Handling  exceptions that occur during AJAX requests. I.e. in the event of an exception during an AJAX request,  it is not desirable to redirect to an error page, instead JavaScript error handling code should be […]

Validation for Hibernate in Spring 3 Web MVC (with Netbeans)

Validation for Hibernate in Spring 3 Web MVC (with Netbeans)

This blog details how to apply Validation to Spring 3 Web MVC forms using Hibernate’s validation framework.

Integrating Hibernate with Spring 3 Web MVC

Integrating Hibernate with Spring 3 Web MVC

This tutorial on “Integrating Hibernate with Spring 3 Web MVC” incorporates: Hibernate Transaction Control @RequestMapping friendly URL’s. More on this specific Spring 3 Web MVC friendly URL topic here. (Alternative @RequestParam method here) A Generic DAO suitable for Hibernate operations with Spring 3 Web MVC. More here in this separate […]

Setting the Welcome Page in Spring Web MVC

Setting the Welcome Page in Spring Web MVC

In any Spring Web MVC application, there is a need to set the default landing or welcome page. Traditionally in Java web applications, this is done in the web.xml file as so:

Or in a spring web mvc application, it might be like this:

With a corresponding controller class RequestMapping: […]

Using @RequestParam to pass in HTTP GET parameters in Spring 3 Web MVC

Using @RequestParam to pass in HTTP GET parameters in Spring 3 Web MVC

Receiving HTTP GET parameters in Spring is made very easy using the @RequestParam annotation.

Annotated Dependency Injection / Inversion of Control (DI / IoC) in Spring 3 Web MVC using Netbeans

Annotated Dependency Injection / Inversion of Control (DI / IoC) in Spring 3 Web MVC using Netbeans

This tutorial will detail how to insert services and components (Dependency Injection) into a Spring 3 Web MVC Netbeans application. The process used is Dependency Injection (DI) or Inverse of Control (IoC) whereby Spring will instantiate (or inject) certain components at runtime rather than at having them initiated at compile […]

Hello Spring 3 Web MVC using Netbeans

Hello Spring 3 Web MVC using Netbeans

6-Nov-2014 –> Please note that a new blog now exists for Spring 4 Web MVC using Maven and Netbeans with Java configuration (no XML at all) here – John This tutorial will simply detail one correct way to create a simple Spring 3 web application using Netbeans. Note: The Spring plugin […]