Search code examples
springjspjstl

Failed to load resource: net::ERR_INCOMPLETE_CHUNKED_ENCODING error occurs when passing model attributes to the JSP page


I'm passing model attributes to the view from my spring controller but the jsp page is not displayed. In the console i'm getting following error :

net::ERR_INCOMPLETE_CHUNKED_ENCODING 200

The controller :

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;
}

The 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>

The model class :

public class PoyntBusinessDetails {
     private String legalName;

     // getters and setters
}

Solution

  • Instead of

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

    Use

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