2013年7月31日星期三

Seeking solutions springMVC appears getOutputStream () has alreadybeen called for this response issue.


@RequestMapping(value="queryMenusForManage")
public @ResponseBody Map<String, Object> queryMenusForManage(ModelAndView mav, HttpServletRequest request, HttpServletResponse response) throws Exception {
List<SysMenu> menuList = menuService.queryMenusForManage();
dealMenu(menuList);
NodeTree<SysMenu> nodeTree = new NodeTree<SysMenu>();
List<SysMenu> dataList = nodeTree.getRootNodeTreeForJqgrid(menuList);
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("rows", dataList);
return resultMap;
}


I return @ ResponseBody in the controller to the front, on display through freemarker, they reported errors such as the following, although the front page lacks impact, but the background has been so annoying error. Seeking solutions

java.lang.IllegalStateException: getOutputStream() has already been called for this response
at org.apache.catalina.connector.Response.getWriter(Response.java:611)
at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:198)
at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:112)
at org.springframework.web.servlet.view.freemarker.FreeMarkerView.processTemplate(FreeMarkerView.java:366)
at org.springframework.web.servlet.view.freemarker.FreeMarkerView.doRender(FreeMarkerView.java:283)
at org.springframework.web.servlet.view.freemarker.FreeMarkerView.renderMergedTemplateModel(FreeMarkerView.java:233)
at org.springframework.web.servlet.view.AbstractTemplateView.renderMergedOutputModel(AbstractTemplateView.java:167)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1180)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:950)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:167)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:600)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1703)
at java.lang.Thread.run(Thread.java:662)

I am looking for the next,

org.springframework.web.servlet.view.freemarker.FreeMarkerView.processTemplate(FreeMarkerView.java:366)

This line of code is just calling getWriter (), so that the previous conflict.

template.process(model, response.getWriter());

------ Solution ------------------------------------- -------
I have encountered a problem, download video, file not found exception report. . But that address is accessible, the above is also the existence of the file. . .
------ Solution ---------------------------------------- ----
jsp try adding the following two lines
out.clear ();
out = pageContext.pushBody ();

------ Solution ------------------------------------ --------
seems to flow used twice, or not close
------ Solution ---------------- ----------------------------
series Use getOutputStream will report this error (getWriter underlying seemingly also use getOutputStream)

here that the series may be referring to the one obtained OutputStream not closed even the use.

but only from the landlord to the method given seemingly do not see signs of possible internal methods.
------ For reference only -------------------------------------- -
show is freemarker to achieve, no more no JAVA code JSP pages. Through the controller to return JSON to the foreground. iteye answer also fly more, saying it was unable to return map, void, mav, but I changed another return type nor
------ For reference only --------- ------------------------------
seemingly freemarker when rendering the foreground component called getWriter
- ---- For reference only ---------------------------------------
find Before looking for a place to get getOutputStream is not necessary to call, or early closure, similar to the second floor of the concepts presented.
------ For reference only -------------------------------------- -

and data types have to do with it? These data types are changed to call getWriter not a?
------ For reference only -------------------------------------- -
not fetch the wrong time, but in the display page when it was being given.
open a URL in order is the first display page, and then use AJAX to fetch data in the background. I take note off data JS method, it was found or an error, and eventually found with the use of EASYUI seemingly relevant. In the class = "easyui-linkbutton" removed after no error, and depressed ing ~ ~ ~ ~
Is it only me in this place, what a fault, check the Internet or downloaded are all verification code before being given to the

<a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="showInfo()">编辑菜单</a>

------ For reference only ----------------------------------- ----
I also met with easyui datagrid display data on the wrong page to the last page, the page can not brush.
was resolved not?

没有评论:

发表评论