Reputation: 927
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
}
Upvotes: 1
Views: 2638
Reputation: 46
Although the above answer has solved your issue. But i would like to add one more answer because the same issue can occur with a different problem as well. When the response or list of objects you are returning from server side is not properly formatted this issue can occur also. To confirm whether the issue is due to formatting check in firefox browser once. And formatting error can happen in spring mvc java when there are too many nested classes.
Upvotes: 0
Reputation: 14943
Instead of
<span class="sub-text">${poyntBusinessDetails.legalName}</span>
Use
<span class="sub-text"><c:out value="${poyntBusinessDetails.legalName}"/></span>
Upvotes: 1