gpt4 book ai didi

java - 无法呈现不是字符串的属性,toString 返回 : null ERROR in SPRING MVC

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:13:13 25 4
gpt4 key购买 nike

我正尝试按照本教程为我的 spring mvc 项目创建一个通用错误处理程序:http://www.mkyong.com/spring-mvc/spring-mvc-exceptionhandler-example/

但在我的项目中,我正在使用 tiles-defs,当我在浏览器中访问错误页面时出现此错误:

org.apache.tiles.request.render.CannotRenderException: Cannot render an attribute that is not a string, toString returns: null
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:255)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:221)
at org.apache.tiles.renderer.DefinitionRenderer.render(DefinitionRenderer.java:59)
at org.springframework.web.servlet.view.tiles3.TilesView.renderMergedOutputModel(TilesView.java:114)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:267)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1217)
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:952)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

这是我的 tiles-defs 配置:

    <definition name="/error/generic_error">
<put-attribute name="body" value="/WEB-INF/views/error/generic_error.jsp" />
<put-attribute name="browserTitle" value="Error Screen" />
</definition>

我找不到此问题的原因或解决方案,因此非常感谢您的帮助。

最佳答案

您需要在磁贴定义中添加基础模板。它应该扩展模板,或者您必须在定义中提及路径属性 <definition name="/error/generic_error" path= "{your-path}">

关于java - 无法呈现不是字符串的属性,toString 返回 : null ERROR in SPRING MVC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24424094/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com