无法将资源加载:net :: ERR_INCOMPLETE_CHUNKED_ENCODING将模型属性传递到JSP页面时发生错误

时间:2019-02-28 14:07:23

标签: spring jsp jstl

我正在将模型属性从spring控制器传递到视图,但未显示jsp页面。在控制台中,我得到以下错误:

net::ERR_INCOMPLETE_CHUNKED_ENCODING 200

控制器:

private final String POYNT_DETAILS_VIEW = "full_poynt_view";

@RequestMapping(value = "/businessDetails/{businessId}/poynt", method = RequestMethod.GET)
public String viewBusinessDetails(Model model, @PathVariable String businessId) throws IOException {

    PoyntBusinessDetails poyntBusinessDetails = poyntApiClient.getPoyntBusinessDetails(businessId,poyntCloudBaseBusinessUrl);

    model.addAttribute("poyntBusinessDetails", poyntBusinessDetails);
    return POYNT_DETAILS_VIEW;
}

视图:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>

 <div style="padding: 5px">
     <span class="main-text">Business Name</span>: 
      <span class="sub-text">${poyntBusinessDetails.legalName}</span>
 </div>

模型类:

public class PoyntBusinessDetails {
     private String legalName;

     // getters and setters
}

1 个答案:

答案 0 :(得分:1)

代替

<span class="sub-text">${poyntBusinessDetails.legalName}</span>

使用

<span class="sub-text"><c:out value="${poyntBusinessDetails.legalName}"/></span>