I have found that the proposed way of serializing and deserializing JSON to a controller commonly has ObjectMapper problems. I prefer to be totally in control of the POST body of the JSON message so I use this pattern instead:
First The JQuery Part, this method posts a JQUERY json model which is the options for a query, and then places the JSON results into a selectable list.
Now we build the controller that will parse that json request and create a JSON View back. This does the work of parsing the JSON and then generating a model that we sent to a template. Yes a template.
Great. Now lets set up the MVC config and view and make sure that we map the extension ".json" to a velocity view. We will need a been that is extension away so we have total control over how our view serializes. Make sure to include the Velocity configuration. This pattern is about control.
The view itself:
And this is the custom resolver that lets us make sure we can serialize the way we want based on extension.
Lets make our Velocity template now:
I wanted a place where I can post technical articles only. This is the place to find out my tips and tricks for being a Java web applications developer. I hope it helps you.
Thursday, October 27, 2011
Friday, October 21, 2011
Find In Files
Find in files
find . | xargs grep 'string' -sl
find '.' -print0 | xargs -0 grep 'saveGeoPlace' -sl
Subscribe to:
Posts (Atom)