There are many methods on an HttpServletRequest, and if you’re anything like me, you’ll forget exactly what each of them returns. Rather than a long winded investigation into them all, here’s a sample URL: https://localhost:8443/test/welcome?a=1&b=2 The ‘/test’ in the URL will map to a servlet called test. The servlet will dispatch the request to a JSP for rendering that has …
Implementing Flash Scope in Java Web Applications
While working recently on a Spring MVC project I found myself wishing it supported flash scope. I hunted around for a simple solution but couldn’t find anything that didn’t rely on having to import large framework libraries. After a little thought I came up with the following simple and lightweight solution that has worked really well for me. I’ve included …
Open Session in View Pattern for Spring and JPA
The Open Session in View Pattern is well publicised in Hibernate circles as the best practice approach to presenting data in the Web tier of an application. In this article I’ll demonstrate how simple it is to configure a Spring application to do the same thing with the Java Persistence API (JPA).
How to Access the Size of a Collection in a JSP Page Using JSTL-EL
A common and frustrating problem that many programmers encounter when first working with JSPs is how to access the size of a Collection using the JavaServer Pages Standard Tag Library (JSTL) and the Expression Language (EL). This article discusses this problem and illustrates a best practice solution. The Problem The JSTL and EL greatly reduce the amount of Java code …