A photo of Brian Douglas

Hi, I'm Brian. Welcome to my blog. Here I write about the things I've learned whilst creating stuff on the web.

I hope that you will find something noteworthy here, that will pique your interest, and that you will visit again soon.

Recent Posts


  • Handle Spring form errors with JTE

    I've been working with JTE (Java Template Engine) templates in my latest Spring app. They are a joy to work with and feel like a more modern alternative to Thymeleaf templates. With Spring however there are some integrations that a Thymeleaf user would expect, that are missing when using JTE. Automatic form error association being one. So I have documented how to pass form errors to your jte templates below.

  • Add a CSRF token to HTML forms with JTE

    When submitting information via an HTML form, Spring Security requires the form to include a CSRF (Cross-Site Request Forgery) token. This token is generated by the Spring app and tied to the user's session. Spring will use it to verify that the form submission is legitimate and not malicious. The token is required on POST, PUT, DELETE, and PATCH requests to protect against CSRF attacks. So when your user is submitting information, the form used to submit said information will need to contain a valid csrf token. This means adding a hidden field to the form that contains the token. In this post I'll demonstrate my reusable solution to this when using Spring and JTE.

  • Spring database seeding

    I'm working on a website that functions as an index of trades people in Ireland. It allows users to register a trade profile detailing their services. This trade profile can then be reviewed by other users. I have this functionality pretty much built out. But until recently I had very little test data, which lead me on a journey into the world of database seeding. Which is the generation of test data that mimics real world data. Here's how I got on.

Older Posts