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 :)

  • Share/Bookmark
This entry was posted in Java, User Interface. Bookmark the permalink.

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

  1. Jeff says:

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

  2. ccnet says:

    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

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>