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就可以了。唉,这个问题坑了我一天。

  • 相关阅读:
    P2802 【回家】
    P1706 【全排列问题】
    P1936 【水晶灯火灵】
    P1319 【压缩技术】
    P2670 【扫雷游戏】
    P1097 【统计数字】
    P1820 【寻找AP数】
    P1020 【导弹拦截】
    链表反转
    队列:队列在有限线程池中的应用
  • 原文地址:https://www.cnblogs.com/tong2018/p/13267439.html
Copyright © 2011-2022 走看看