I am wondering if Java Spring MVC has some sort of implementation that relates to returning partial views like ASP.NET MVC? Basically I want to return HTML, that is bound to an object and return it to a javascript callback to append to the dom, stead of building the html with Jquery (which is tedious). If not I may go with Jquery templates.
1 Answer
I have done something like what you are asking. Basically I created a view, but I didn't associate it to the default layout. That way, when you load the view it only contains the HTML of the view, and not all the extras from the default layout.
Sorry I don't have the code on me to share.
3 Comments
Mike Flynn
So you could have a single .jsp file, with a single table (no body, head tags), and a for loop that renders a list from a model, and return that as the response?
Iain
Thats pretty much it. I would have <html><body>content</body></html>, as I think jQuery will strip away those tags, and it means you are returning valid html.
Mike Flynn
An example or tutorial would be nice using pojos.