freemarker中遇到NULL的问题

14:30:30.661 ERROR freemarker.runtime - Expression bean is undefined on line 45, column 101 in WEB-INF/t/cms/inner_manager/default/special/user_inner_super_add.html.
freemarker.core.InvalidReferenceException: Expression bean is undefined on line 45, column 101 in WEB-INF/t/cms/inner_manager/default/special/user_inner_super_add.html.
 at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124) ~[freemarker-2.3.16.jar:2.3.16]
 at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:134) ~[freemarker-2.3.16.jar:2.3.16]
 at freemarker.core.Dot._getAsTemplateModel(Dot.java:78) ~[freemarker-2.3.16.jar:2.3.16]
 at freemarker.core.Expression.getAsTemplateModel(Expression.java:89) ~[freemarker-2.3.16.jar:2.3.16]
 at freemarker.core.BuiltIn$defaultBI._getAsTemplateModel(BuiltIn.java:843) ~[freemarker-2.3.16.jar:2.3.16]
 at freemarker.core.Expression.getAsTemplateModel(Expression.java:89) ~[freemarker-2.3.16.jar:2.3.16]
 at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:86) ~[freemarker-2.3.16.jar:2.3.16]
 at freemarker.core.Expression.getAsTemplateModel(Expression.java:89) ~[freemarker-2.3.16.jar:2.3.16]
 at freemarker.core.Expression.getStringValue(Expression.java:93) ~[freemarker-2.3.16.jar:2.3.16]
 at freemarker.core.DollarVariable.accept(DollarVariable.java:76) ~[freemarker-2.3.16.jar:2.3.16]
 at freemarker.core.Environment.visit(Environment.java:210) [freemarker-2.3.16.jar:2.3.16]
 at freemarker.core.MixedContent.accept(MixedContent.java:92) [freemarker-2.3.16.jar:2.3.16]
 at freemarker.core.Environment.visit(Environment.java:210) [freemarker-2.3.16.jar:2.3.16]
 at freemarker.core.Environment.process(Environment.java:190) [freemarker-2.3.16.jar:2.3.16]
 at freemarker.template.Template.process(Template.java:237) [freemarker-2.3.16.jar:2.3.16]
 at com.westi.common.web.springmvc.SimpleFreeMarkerView.renderMergedTemplateModel(SimpleFreeMarkerView.java:111) [SimpleFreeMarkerView.class:na]
 at org.springframework.web.servlet.view.AbstractTemplateView.renderMergedOutputModel(AbstractTemplateView.java:167) [spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]
 at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250) [spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]
 at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047) [spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]
 at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817) [spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]
 at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) [spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]
 at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) [spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]
 at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560) [spring.web.servlet-3.0.5.jar:3.0.5.RELEASE]
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) [servlet-api.jar:na]
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) [servlet-api.jar:na]
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) [catalina.jar:6.0.29]
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.29]
 at com.westi.common.web.XssFilter.doFilter(XssFilter.java:41) [XssFilter.class:na]
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:6.0.29]
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.29]
 at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) [spring.orm-3.0.5.jar:3.0.5.RELEASE]
 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) [spring.web-3.0.5.jar:3.0.5.RELEASE]
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:6.0.29]
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.29]
 at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring.web-3.0.5.jar:3.0.5.RELEASE]
 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) [spring.web-3.0.5.jar:3.0.5.RELEASE]
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:6.0.29]
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.29]
 at com.westi.common.web.ProcessTimeFilter.doFilter(ProcessTimeFilter.java:35) [ProcessTimeFilter.class:na]
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:6.0.29]
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.29]
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) [catalina.jar:6.0.29]
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [catalina.jar:6.0.29]
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [catalina.jar:6.0.29]
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [catalina.jar:6.0.29]
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [catalina.jar:6.0.29]
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) [catalina.jar:6.0.29]
 at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861) [tomcat-coyote.jar:6.0.29]
 at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579) [tomcat-coyote.jar:6.0.29]
 at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584) [tomcat-coyote.jar:6.0.29]
 at java.lang.Thread.run(Thread.java:619) [na:1.6.0_10-rc2]


问题背景:做项目时 遇到显示后台传过来的实体bean  但是有时候bean 时NULL ,如果这样写   就会报上面的错误
所以把代码改成
即可

你可能感兴趣的:(freemarker,java)