5

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 1

2

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.

Sign up to request clarification or add additional context in comments.

3 Comments

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?
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.
An example or tutorial would be nice using pojos.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.