【问题标题】:Ajax invocation from Spring MVC Liferay 6.1 portal来自 Spring MVC Liferay 6.1 门户的 Ajax 调用
【发布时间】:2012-03-30 13:14:24
【问题描述】:

我们使用带有 Liferay 6.1 的 SpringMVC portlet 框架来开发门户。我们目前面临的问题是,我们无法通过我们的 jsp 页面中的 ajax 调用来调用控制器类中的 servResouce 方法。

谁能指出解决方案。

【问题讨论】:

    标签: ajax liferay-6


    【解决方案1】:

    在你的 Spring 控制器中,将资源方法定义为

    Public ModelAndView serveResource(ResourceRequest req, ResourceResponse res)
    {
      ...
      res.setContentType("application/json; charset=...");
      return new ModelAndView("res_page", model);
    }
    

    并设置您的 res_page.jsp 响应页面,其中:

    <% page contentType="text/html; charset=..." %>
    <%-- text/html has no effective effect on your response contentType --%>
    <% (your taglibs) %>
    {
      (your data)
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-21
      • 2013-10-30
      • 2011-04-27
      • 2012-08-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多