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 view mode will render it as IE7 does.

 

Comments welcome…..

 

 

 

Hello Spring 3 Security with Netbeans – Role Based Method Protection

This tutorial will outline in simple steps how to do the following:

  1. Create Spring 3 Web MVC project using Netbeans
  2. Introduce Spring Security measures
  3. Limit @Controller method invocation to certain User-Role’s using Annotations
  4. Roles and users are defined within XML configurations.
  5. The full source code is available for download here

Continue reading “Hello Spring 3 Security with Netbeans – Role Based Method Protection”

Spring 3 Web MVC – Exception Handling – incorporating AJAX

Spring 3 Web MVC Exception Handling with AJAX
Spring 3 Web MVC Exception Handling

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 invoked with relevant information passed in.

 

A Netbeans project is available for download at the bottom of this page.

Continue reading “Spring 3 Web MVC – Exception Handling – incorporating AJAX”

Integrating Hibernate with Spring 3 Web MVC

This tutorial on “Integrating Hibernate with Spring 3 Web MVC” incorporates:

  1. Hibernate Transaction Control
  2. @RequestMapping friendly URL’s. More on this specific Spring 3 Web MVC friendly URL topic here. (Alternative @RequestParam method here)
  3. A Generic DAO suitable for Hibernate operations with Spring 3 Web MVC. More here in this separate Generic DAO tutorial.
  4. Spring 3 Web MVC Dependency Injection (DI) and Inversion  of Control (IoC). More on DI and IoC here.
  5. Netbeans (7.1.1 used here but any version will do)

The complete Netbeans project is available for download here. The SQL for the project is included in the download in the WEB-INF folder.

Update: Jan 8, 2014

———–

The project originally available for download does not work with Netbeans 8 due to libraries that were in Netbeans 7.1.1 no longer available in Netbeans 8. Additionally, a comment below referencing Netbeans 7.0 .1 may suggest the same problem. This enforces the point that a dependency management utility is a much better means of building projects. To that end this project has been recreated using Maven. This ensures it will work irrespective of IDE version. In fact because it’s a maven project it’s not dependant on an IDE at all. It should work on any IDE that supports Maven. Netbeans of course, does support Maven. Here is the download link SpringHibernateCrudMvn for the Maven version of this application.

The POM is quite comprehensive in that it includes support for Spring, Spring-Security, Jackson, Hibernate, Hibernate-search and a bunch of other utilities. It can serve as a template to a certain extent.

—————————————————— (/End Update)

Continue reading “Integrating Hibernate with Spring 3 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:

 

This is ok, because “/” is a valid existing URL but, if the required welcome page is to be a virtual URL such as /person/list a little more creativity is required.
Continue reading “Setting the Welcome Page in Spring Web MVC”

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
Continue reading “Determining the primary key property name using Hibernate”