RSS Feed Subscribe to RSS Feed

 

Handsontable ‘Spreadsheet’ talking to SpringMVC

Handsontable is an Excel-like data grid utilizing JQuery. For example, it provides the ability to copy and paste directly to & from Excel. Handsontable itself if very easy to setup. The part I struggled with was passing the data to SpringMVC. So, this post shows how to send data from a Handsontable data grid on the client to a SpringMVC server.

Read more

Tags: , , , , , , ,

SpringMVC file download

This post shows how to download a file using Spring MVC. For example, you have a SpringMVC web app and you want to include a link on a page that downloads a file to be opened on the user’s machine (e.g. a Microsoft Excel).
Read more

Tags: ,

MyMoney – A simple SpringMVC app

I created a small, open source web app called MyMoney for entering and tracking spending details. It allows you to create accounts (for example Cash or Checking) and enter transactions associated with those accounts.

The app is running at http://mymoney.shaunabram.cloudbees.net and the sourecode is available via GitHub.
Read more

Tags: , ,

415 ‘Unsupported Media Type’ error when submitting JSON from a JSP

I’ve been experimenting with submitting JSON data from a JSP to a Spring MVC Controller, using the Spring MVC Ajax example as my guide.

But after setting everything up, I continually ran into this error:

NetworkError: 415 Unsupported Media Type
The server refused this request because the request entity is in a format not supported by the requested resource for the requested method().

After much googling, I found a plethora of solutions, none of which worked for me. In the end, I found it was because I had omitted this line from my JSP:

Hope that helps someone else…

Tags: , , ,

Spring MVC Hello World with Continuous Deployment

Oh dear, yet another ‘Hello World!’. But although the functionality is trivial, this little SpringMVC project is complete enough for me to use as a template to bootstrap more complex projects. It consists of:

  • HTML/JSP client
  • SpringMVC server using a Controller/Service/DAO design
  • Maven for build and dependency management

This is an updated version of an older project I created, with the following enhancements:

  • Added a full suite of automated tests (unit, integration and browser based)
  • Added placeholders for JavaScript and images (both can be a little tricky to put in the correct place with SpringMVC)
  • Incorporated into a continuous deployment environment

More details below, but you can find the full source code on this GitHub repository and the deployed app at http://springmvc.shaunabram.cloudbees.net.
Read more

Tags: , , , , , , , , , , ,

Spring MVC Hello World

There is a good Getting Started with Spring MVC blog post over on the Spring team blog.

I have created several Spring MVC projects for both work and play, and am attaching my own simple version of the HelloWorld example here, based on the Spring blog example.
Find my maven ready source here.
Like my previous JSP/Servlet example, I find these templates useful for getting prototypes up and running.

Tags: , , , , , ,

Spring Enterprise Recipes

I recently found out that this book has just been published:
Spring Enterprise Recipes: A Problem-Solution Approach
It is written by Josh Long and Gary Mak. I have heard Josh speak at several conferences, followed his articles on TheServerSide (as well as on his blog) and recently got to hang out with him at the SoCal Code Camp. He is very knowledgeable about Spring and enterprise integration and since Gary is already an author of one of the leading Spring books (Spring recipes), this should be a great book. I have just ordered my copy and will try to post a review when I am done with it.

Tags: ,

‘An Introduction to Spring’ at LA Code Camp

I gave my ‘An Introduction to Spring’ talk today at the LA code camp. It went fairly well I think. I had very little time to go through the Spring MVC module at the end, but perhaps I will give that as a separate talk another day.

I have posted the presentation slides here.

Tags: , ,

Speaking at LA Code Camp

I am very pleased to say I will be speaking at the LA Code Camp this weekend. My topic is An Introduction to Spring. I will try to post a report from the code camp this weekend…

This is the same talk I had planned to present at the Silicon Valley Code Camp, so great to be finally giving it…

Tags: , ,

Data binding in Spring MVC

Two of the most important tasks carried out by Spring MVC when you submit a form are Data binding and validation.
The following article discusses data binding, including the use of custom PropertyEditors, and some of the options available for registering such editors. Most of the information discussed applies to Spring in general, but its application in Spring MVC is my primary interest.

In a future article I would like to discuss validation including the use of custom error messages.

Note that these notes relate to version 2.5.6 of Spring, the latest production code at time of writing, and depend heavily on the corresponding Spring reference docs.

Read more

Tags: ,