Bo Andersen

I am a back-end web developer with a passion for open source technologies. I have been a PHP developer for many years, and also have experience with Java and Spring Framework. I currently work full time as a lead developer. Apart from that, I also spend time on making online courses, so be sure to check those out!

Posts by Bo Andersen

Date Parameter in Spring MVC Controller

March 1, 2015 by

Need to pass a date as a java.util.Date instance in a Spring MVC controller action? Then you have come to the right place. You might have tried the below approach and encountered a good old 404 Not Found error. @Controller public class CompanyController { @RequestMapping("/company/added-since/{since}") public String showAddedSince(@PathVariable("since") Date since) { return "companies-added-since"; } }… read more

Resetting PostgreSQL Sequence

February 21, 2015 by

Okay folks, this is going to be a short one! Sometimes you may want to reset a PostgreSQL sequence, for instance after removing data from a tabel. You can do this very easily by executing the following statement: ALTER SEQUENCE company_id_seq RESTART WITH 1; company_id_seq is the name of the sequence that you want to… read more

Neither BindingResult nor plain target object available as request attribute

February 21, 2015 by

If you are trying to bind a Spring MVC form to a bean, then you might have come across the below exception. Neither BindingResult nor plain target object for bean name ‘mybean’ available as request attribute Some tutorials claim that you can do like this: @Controller public class PersonController { @RequestMapping(value = "/person/add", method =… read more

Installing nginx on OS X Yosemite

December 17, 2014 by

As always, there are many ways to accomplish this. My approach is based on Homebrew and assumes that you have it installed. If not, then the first thing you have to do is to install it. Installing nginx on OS X To install nginx, simply open up the Terminal and enter the following command. brew… read more

ZF2: Accessing View Helpers in Controllers

July 4, 2014 by

Generally speaking, view helpers should not be used within controllers, as the name suggests. Certain situations may, however, require one to do so. This article shows you just how to do that by fetching the view helper manager from the service manager. It is actually very simple. public function someAction() { $userData = ‘User data… read more

Adding Query Parameters with ZF2 URL Helper

June 12, 2014 by

In a view script in Zend Framework 2, one may need to generate an URL for a given route that includes one or more query parameters. For instance, when browsing through a paginated data set, one may want a form’s action attribute to point to the current page, such that the user will end on… read more