jqueryspringliferayspring-portlet-mvc

Spring controller returns html


I'm working with Spring MVC, Liferay and jQuery. There is a ajax request (post) which invokes controller's method. The method is annotated by @ActionMapping.

I have some misunderstanding with response, cause html of whole page is returned to my ajax's callback. The html looks like: '< !DOCTYPE html> < html class="aui ltr" dir="ltr" lang="en-US"> < head> < title> ...'

Is it possible to return more readable response? Is @ActionMapping root cause of this response?


Solution

  • I can't tell you the definitive answer on spring, but in the portal world, everything labelled "Action" typically returns the whole page, while everything labelled "Resource" is an actual Ajax call and can return arbitrary content types.

    As a quick search for @ResourceMapping also returns results, this might be what you want to try.