Tag: JSP

Force IE out of compatibility mode

Force IE out of compatibility mode

Add this to within the <head> <meta http-equiv=”X-UA-Compatible” content=”IE=edge” /> This forces IE out of compatibility mode. IE will ignore compatibility mode settings from the ‘(F12) Developer Tools’ facility. Here’s some code that will allow testing. Done using ‘IE Tester’ http://www.my-debugbar.com/wiki/IETester/HomePage IE7 and IE8 will render this differently. IE8 in compatibility […]

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

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: […]

Determining the primary key value of an entity bean using reflection

Determining the primary key value of an entity bean using reflection

Given some Entity Object or generic type T, it may be useful to determine the value of the primary key without knowing the object type.

Determining the primary key property name using Hibernate

Determining the primary key property name using Hibernate

Simple method:

String idPropertyName = sessionFactory.getClassMetadata(User.class).getIdentifierPropertyName(); To get the actual value see this tutorial Elaboration

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.

Creating a Java Web Application Filter

Creating a Java Web Application Filter

Just a simple note to demonstrate this. Create a source file that implements

This interface provides three methods: