views:

25

answers:

0

hi, all

I am quite new to Spring MVC, and trying to figure out how to render a partial view without refreshing the whole page. I thought:

  • if I can post a request to the backend, in this case, a Spring controller method

  • And if this method fills in model attribute, and then return ModelAndView object with specified view name mapping to a JSP file, and JSP is able to generat the necessary HTML fragment.

  • The returned HTML fragment will be inserted into a DIV placeholder.

This probably wouldn't work, but I am not sure what's wrong with it? I got as far as the JSP is called upon to render the view, but for some reason, the model attribut I put into the session doesn't seem to be there.

I'd appreciate if anyone with similar experience can provide some examples on this subject, or point to me where it potentially went wrong.

I read something from Spring web flow to handle Ajax request with fragmented view, but I am not sure I get the idea on how it actually works.

Thanks in advance.

Oliver