How *not* to use the Spring MVC Form tag library

I hadn’t used the Spring form tag library before and decided to give it a shot for a small test form I was creating. I am using a subclass of SimpleFormController to return a simple list of value/name pairs from a database call to populate a select/option list in the HTML. I figured it would be easy enough to return an ArrayList as my command object and that is populated with HashMaps of the key/values. Oops. Doesn’t work.

It appears that I have to create an object that holds the list (or maybe a list of objects with fields that are the items I need displayed in the select dropdown). It’s too bad that I can’t do it the way I want with that tag library ;) Since this is a throw away screen though (I suppose the controller is as well) I’m not going to worry too much about it :)

2 Comments so far

  1. Jeff on February 2nd, 2008

    did you take a look at the referenceData() method?

  2. jkratz on February 2nd, 2008

    Jeff-

    Yeah I do know about referenceData(). I just thought using formbackobject would be a quick and dirty way and it appears that it would work just fine if I just used an object that contained a list instead of just passing in the list ;)

Leave a reply