Latest Posts Under: Spring

One of the challenges we face with coding is dealing with coupling. Coupling is an important aspect of programming, it tells us how much our code is tangled. When coupling is too high, we can’t easily re-use code. When the coupling is too low it does little. You can measure coupling, there are several metrics for it even (for instance “Coupling between Objects, CBO”). In this blog post I’d like to talk about a subtle introduction of coupling: when you introduce a factory method. Consider you have an interesting piece of code, and this piece… Read Article →

(I have recently encountered this with Spring 3.1) Want to validate your forms using Spring? Are you using the form tag and bind it with an object? Got the validator working? But still you just can’t seem to get these error messages showing up? Here is a gotcha that might help you out! Consider this controller: [sourcecode language=”java”] @Controller public class FormController { @RequestMapping("/form") public ModelAndView handleGet(@Valid TellAFriendForm backingForm, BindingResult bindingResult) { ModelAndView modelAndView = new ModelAndView("backingForm"); modelAndView.addObject("backingForm", backingForm); modelAndView.addObject("result", bindingResult); return modelAndView; } } [/sourcecode] With this jsp: [sourcecode language=”java”] <form:form method="POST" commandName="myForm" action="?">… Read Article →

I’ve visited JFall, a conference held by the NLJUG (Dutch Java User Group), at 2 november 2011. In this blog I’d like to share my experiences of this conference. This was my first time at this conference and I pretty much had no expectations. There was a lot to go to; I have visited the following seemingly interesting topics: – Keynote – Java 7 Directors Cut – Overthere – Design and implementation of a Java Remote File and Execution framework – Hands on lab – Clojure – A gentle introduction to a brilliant language –… Read Article →

Recently I have had the opportunity to fix a cross-site-scripting problem. The problem: a lot of JSON objects are being sent over the wire and the data is not being html escaped. This means that anyone who would put html data IN would get it out and make any user vulnerable for XSS attacks. In this case, JSON objects are being created by using the MappingJacksonHttpMessageConverter. This is deliverd by the Spring framework. Normally it is instantiated when you use spring-mvc (using the mvc-annotation tag). This allowed us to just return an object and the… Read Article →

Scroll To Top