zoukankan      html  css  js  c++  java
  • thymeleaf使用实例

    map取值遍历,dicts为map<string,Object>类型。 

     <option th:each="dict :${dicts['mpsTypes']}" th:value="${dict!=null}?${dict.id}:''" th:text="${dict!=null}?${dict.name}:''"
                                                     th:checked="${dict.id}==${oc.configType}"></option>
    

      

    报错处理

    2020-07-08 16:09:09.189 ERROR 14376 --- [nio-8083-exec-2,,,,] org.thymeleaf.TemplateEngine : [THYMELEAF][http-nio-8083-exec-2] Exception processing template "org/orgConfig": Exception evaluating SpringEL expression: "oc.systemCode" (org/orgConfig)
    2020-07-08 16:09:09.192 ERROR 14376 --- [nio-8083-exec-2,,,,] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "oc.systemCode" (org/orgConfig)] with root cause

    org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'systemCode' cannot be found on null

    1.注意对象是否为空

    2.注意命名是否冲突,是否正确

    3.遍历内容多时,可以通过删除排查报错行

    4.看下html标签是否符合规范,我的出现问题的原因是table里,tr外卖套了div循环,后来改成tbody就可以了。唉,这个问题坑了我一天。

  • 相关阅读:
    测试方法与步骤
    团队项目需求分析
    第一次个人作业
    3种shell自动交互的方法
    mysql用户管理
    build web application with golang
    安卓中的LINUX内核
    结对项目小结
    关于aria2-yaaw下载软件
    软工结对项目预览
  • 原文地址:https://www.cnblogs.com/tong2018/p/13267439.html
Copyright © 2011-2022 走看看