spring boot+ Thymeleaf 数据校验时返回错误信息使用th标签读取不到值 5C

第一次使用springboot中的thymeleaf获取controller中的值,但是提示错误
图片说明
图片说明

1个回答

singlePerson.name需要在后端绑定值,并且name字段不能为null。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
spring boot+ Thymeleaf 数据校验时返回错误信息使用th标签读取不到值
第一次使用springboot中的thymeleaf获取controller中的值,但是提示错误 ![图片说明](https://img-ask.csdn.net/upload/201708/01/1501594163_423423.png) ![图片说明](https://img-ask.csdn.net/upload/201708/01/1501594173_115715.png)
spring boot 中使用thymeleaf引用css
![图片说明](https://img-ask.csdn.net/upload/201707/27/1501159521_302815.png) 如图在spring boot 中使用thymeleaf引用css,为什么还是会提示找不到这个CSS,导致最后也没有起到效果,问题出在哪里呢?
spring boot+thymeleaf与html+json+spring boot比哪个更好?
最近在自学spring boot,看到做页面时用了thymeleaf,感觉和jsp差不多就是功能更强大了些。但是困扰我的是,这样前后端不就又缠到一起了吗?之前用过纯html用json来交互,用spring配上swagger做接口,简直爽的不要不要的了,前后分离,后台专心做数据,前端专心展示数据,分工明确且效率高,那么用回thymeleaf这样的东西是不是倒退了,还请大神教导一下,谢谢!
spring boot+thymeleaf+js的问题
if (ids.length < 1) { alert("您还没有选中!"); return false; } 页面js如上,运行会出现: 页面报错: -----------------------错误信息开始--------------------------- Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Sat Nov 04 09:55:55 CST 2017 There was an unexpected error (type=Internal Server Error, status=500). Exception parsing document: template="test", line 151 - column 25 -------------------------错误信息结束------------------------- 控制台报错: ----------------------错误信息开始---------------------------- 2017-11-04 10:04:43.833 ERROR 9032 --- [nio-8080-exec-4] o.thymeleaf.templateparser.ErrorHandler : [THYMELEAF][http-nio-8080-exec-4] Fatal error during parsing org.xml.sax.SAXParseException: 元素内容必须由格式正确的字符数据或标记组成。 at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) ~[na:1.8.0_144] at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177) ~[na:1.8.0_144] at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400) [na:1.8.0_144] at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327) [na:1.8.0_144] at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1472) [na:1.8.0_144] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.startOfMarkup(XMLDocumentFragmentScannerImpl.java:2635) [na:1.8.0_144] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2732) [na:1.8.0_144] at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602) [na:1.8.0_144] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505) [na:1.8.0_144] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841) [na:1.8.0_144] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770) [na:1.8.0_144] at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) [na:1.8.0_144] at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213) [na:1.8.0_144] at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643) [na:1.8.0_144] at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327) [na:1.8.0_144] at org.thymeleaf.templateparser.xmlsax.AbstractNonValidatingSAXTemplateParser.doParse(AbstractNonValidatingSAXTemplateParser.java:209) [thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.thymeleaf.templateparser.xmlsax.AbstractNonValidatingSAXTemplateParser.parseTemplateUsingPool(AbstractNonValidatingSAXTemplateParser.java:134) [thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.thymeleaf.templateparser.xmlsax.AbstractNonValidatingSAXTemplateParser.parseTemplate(AbstractNonValidatingSAXTemplateParser.java:116) [thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.thymeleaf.TemplateRepository.getTemplate(TemplateRepository.java:278) [thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1104) [thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1060) [thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1011) [thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.thymeleaf.spring4.view.ThymeleafView.renderFragment(ThymeleafView.java:335) [thymeleaf-spring4-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.thymeleaf.spring4.view.ThymeleafView.render(ThymeleafView.java:190) [thymeleaf-spring4-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1286) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1041) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:984) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:635) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) [spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.23.jar:8.5.23] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_144] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_144] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.23.jar:8.5.23] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_144] 2017-11-04 10:04:43.834 ERROR 9032 --- [nio-8080-exec-4] org.thymeleaf.TemplateEngine : [THYMELEAF][http-nio-8080-exec-4] Exception processing template "test": Exception parsing document: template="test", line 151 - column 25 2017-11-04 10:04:43.835 ERROR 9032 --- [nio-8080-exec-4] 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.TemplateInputException: Exception parsing document: template="test", line 151 - column 25] with root cause org.xml.sax.SAXParseException: 元素内容必须由格式正确的字符数据或标记组成。 at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) ~[na:1.8.0_144] at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177) ~[na:1.8.0_144] at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400) ~[na:1.8.0_144] at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327) ~[na:1.8.0_144] at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1472) ~[na:1.8.0_144] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.startOfMarkup(XMLDocumentFragmentScannerImpl.java:2635) ~[na:1.8.0_144] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2732) ~[na:1.8.0_144] at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602) ~[na:1.8.0_144] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505) ~[na:1.8.0_144] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841) ~[na:1.8.0_144] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770) ~[na:1.8.0_144] at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) ~[na:1.8.0_144] at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213) ~[na:1.8.0_144] at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643) ~[na:1.8.0_144] at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327) ~[na:1.8.0_144] at org.thymeleaf.templateparser.xmlsax.AbstractNonValidatingSAXTemplateParser.doParse(AbstractNonValidatingSAXTemplateParser.java:209) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.thymeleaf.templateparser.xmlsax.AbstractNonValidatingSAXTemplateParser.parseTemplateUsingPool(AbstractNonValidatingSAXTemplateParser.java:134) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.thymeleaf.templateparser.xmlsax.AbstractNonValidatingSAXTemplateParser.parseTemplate(AbstractNonValidatingSAXTemplateParser.java:116) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.thymeleaf.TemplateRepository.getTemplate(TemplateRepository.java:278) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1104) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1060) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1011) ~[thymeleaf-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.thymeleaf.spring4.view.ThymeleafView.renderFragment(ThymeleafView.java:335) ~[thymeleaf-spring4-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.thymeleaf.spring4.view.ThymeleafView.render(ThymeleafView.java:190) ~[thymeleaf-spring4-2.1.5.RELEASE.jar:2.1.5.RELEASE] at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1286) ~[spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1041) ~[spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:984) ~[spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) ~[spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) ~[spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:635) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) ~[spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-embed-websocket-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108) ~[spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) ~[spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) ~[spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.23.jar:8.5.23] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_144] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_144] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.23.jar:8.5.23] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_144]l.impl.XMLScanner.reportFatalError(XMLScanner.java:1472) [na:1.8.0_144] ----------------------错误信息结束----------------------------
spring boot 2外部tomcat启动错误:check whether you have multiple ContextLoader* definitions in your web.xml!
spring boot 2外部tomcat启动错误 java.lang.IllegalStateException: Cannot initialize context because there is already a root application context present - check whether you have multiple ContextLoader* definitions in your web.xml! pom: ``` <!-- Spring Boot Dubbo 依赖 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> <exclusions> <exclusion> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> </exclusion> <exclusion> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <!-- <scope>compile</scope>--> <scope>provided</scope><!-- 必须要加,不然报错 --> </dependency> <!-- <dependency>--> <!-- <groupId>org.springframework.boot</groupId>--> <!-- <artifactId>spring-boot-starter-velocity</artifactId>--> <!-- <version>1.2.2.RELEASE</version>--> <!-- </dependency>--> <!-- <dependency>--> <!-- <groupId>org.springframework.boot</groupId>--> <!-- <artifactId>spring-boot-legacy</artifactId>--> <!-- <version>1.1.0.RELEASE</version>--> <!-- </dependency>--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>com.alibaba.boot</groupId> <artifactId>dubbo-spring-boot-starter</artifactId> <version>0.2.0</version> </dependency> ``` web.xml检查过没有ContextLoaderListener,ContextLoaderListener和RequestContextListener写在代码中 ``` @Configuration public class ListenerConfig { /** * 配置 RequestContextListener * @return */ @Bean public ServletListenerRegistrationBean<RequestContextListener> listenerRegistration1() { return new ServletListenerRegistrationBean<>( new RequestContextListener()); } /** * 配置 ContextLoaderListener * @return */ @Bean public ServletListenerRegistrationBean<ContextLoaderListener> listenerRegistration2(){ return new ServletListenerRegistrationBean<>( new ContextLoaderListener() ); } } ```
spring+thymeleaf页面加载出错
spring+thymeleaf,页面加载出错 ![图片说明](https://img-ask.csdn.net/upload/201801/29/1517190210_226781.jpg)
springboot传输数据到thymeleaf的一个问题
![图片说明](https://img-ask.csdn.net/upload/202001/22/1579656541_463369.png) +++ ![图片说明](https://img-ask.csdn.net/upload/202001/22/1579656553_819305.png) +++ +++ +++ **1、图一红框处,我把 查询所有的数据 放进了 map里面,但是并没有用类似addAttribute的方法把map传出去,为什么前端还能直接拿到map的数据呢? | 2、请问大神们有没有比较全面的 thymeleaf传值 的资料或者链接能发给我看看(这里可以再加点分)**
spring boot 前台向后台用thymeleaf传参
前台代码 ``` <form th:action="@{/loadredisstatus}" method="post" th:object="${redisbaseinfo}" > <select class="width-40 chosen-select" name="knowledgePointIdSet" data-placeholder="选择redis"> <option th:each="redisinfolist:${session.redisinfolist}" th:value="${redisinfolist.getRedisIp()}+':'+${redisinfolist.getRedisPort()}" th:text="${redisinfolist.getRedisIp()}+':'+${redisinfolist.getRedisPort()}" th:field="*{ipandport}" >模块名称</option> </select> <input type="submit" /> </form> ``` 后台代码 ``` @RequestMapping(value = "/loadredisstatus", method = RequestMethod.POST) public void loginPost(Model model, @ModelAttribute(value = "redisbaseinfo") RedisBaseInfo redisbaseinfo, HttpServletResponse response, HttpSession session) { String ipandport=redisbaseinfo.getIpandport(); System.out.println("in loadredisstatus "+ipandport); if(ipandport!=null&&!ipandport.trim().equals("")){ String [] arr=ipandport.split(":"); addCourse(response,session,arr[0],arr[1]); } } ``` RedisBaseInfo代码 ``` public class RedisBaseInfo extends BaseObject { private String ipandport; public String getIpandport() { return ipandport; } public void setIpandport(String ipandport) { this.ipandport = ipandport; } } ``` 如上所示现在 ``` th:object="${redisbaseinfo}" ``` 和 ``` th:field="*{ipandport}" ``` 两处报错,运行的话根本运行不起来,想实现的功能是选择一个下拉菜单选项并点击按钮提交后吧他的text封装到redisbaseinfo类里面传到后台处理,请问具体该怎么改这段代码呢
spring boot 集成 thymeleaf 静态资源响应Content-Type: application/json;charset=UTF-8
正常配置了 静态资源访问 ``` @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/"); } ```
thymeleaf 怎么动态引入html?
我想实现一个左侧是菜单,点击菜单右侧加载不同的html页面 ,用的是spring boot +thymeleaf 不用iframe做 ,各位大神求指点!!!!
thymeleaf实现ifream效果
前端页面整合了thymeleaf以后,ifream标签就没效果了。使用 th:replace 标签就把页面写死了。 请问怎么实现点击左侧导航栏,使右侧区域呈现不同的html页面呢? 求大神解答!
spring boot 运行出错了 Application failed to start with classpath?
![图片说明](https://img-ask.csdn.net/upload/201908/23/1566554233_948115.png) ```java "C:\Program Files\Java\jdk1.8.0_121\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=50188 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:E:\IDEA2018.2.3\lib\idea_rt.jar=50189:E:\IDEA2018.2.3\bin -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_121\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\rt.jar;E:\maven\kexie\target\classes;C:\Users\amdin\.m2\repository\org\springframework\boot\spring-boot-starter-thymeleaf\2.1.7.RELEASE\spring-boot-starter-thymeleaf-2.1.7.RELEASE.jar;C:\Users\amdin\.m2\repository\org\springframework\boot\spring-boot-starter\2.1.7.RELEASE\spring-boot-starter-2.1.7.RELEASE.jar;C:\Users\amdin\.m2\repository\org\springframework\boot\spring-boot\2.1.7.RELEASE\spring-boot-2.1.7.RELEASE.jar;C:\Users\amdin\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.1.7.RELEASE\spring-boot-autoconfigure-2.1.7.RELEASE.jar;C:\Users\amdin\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.1.7.RELEASE\spring-boot-starter-logging-2.1.7.RELEASE.jar;C:\Users\amdin\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\amdin\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\amdin\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.11.2\log4j-to-slf4j-2.11.2.jar;C:\Users\amdin\.m2\repository\org\apache\logging\log4j\log4j-api\2.11.2\log4j-api-2.11.2.jar;C:\Users\amdin\.m2\repository\org\slf4j\jul-to-slf4j\1.7.26\jul-to-slf4j-1.7.26.jar;C:\Users\amdin\.m2\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;C:\Users\amdin\.m2\repository\org\yaml\snakeyaml\1.23\snakeyaml-1.23.jar;C:\Users\amdin\.m2\repository\org\thymeleaf\thymeleaf-spring5\3.0.11.RELEASE\thymeleaf-spring5-3.0.11.RELEASE.jar;C:\Users\amdin\.m2\repository\org\thymeleaf\thymeleaf\3.0.11.RELEASE\thymeleaf-3.0.11.RELEASE.jar;C:\Users\amdin\.m2\repository\org\attoparser\attoparser\2.0.5.RELEASE\attoparser-2.0.5.RELEASE.jar;C:\Users\amdin\.m2\repository\org\unbescape\unbescape\1.1.6.RELEASE\unbescape-1.1.6.RELEASE.jar;C:\Users\amdin\.m2\repository\org\thymeleaf\extras\thymeleaf-extras-java8time\3.0.4.RELEASE\thymeleaf-extras-java8time-3.0.4.RELEASE.jar;C:\Users\amdin\.m2\repository\org\mybatis\spring\boot\mybatis-spring-boot-starter\2.0.1\mybatis-spring-boot-starter-2.0.1.jar;C:\Users\amdin\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\2.1.7.RELEASE\spring-boot-starter-jdbc-2.1.7.RELEASE.jar;C:\Users\amdin\.m2\repository\com\zaxxer\HikariCP\3.2.0\HikariCP-3.2.0.jar;C:\Users\amdin\.m2\repository\org\springframework\spring-jdbc\5.1.9.RELEASE\spring-jdbc-5.1.9.RELEASE.jar;C:\Users\amdin\.m2\repository\org\springframework\spring-tx\5.1.9.RELEASE\spring-tx-5.1.9.RELEASE.jar;C:\Users\amdin\.m2\repository\org\mybatis\spring\boot\mybatis-spring-boot-autoconfigure\2.0.1\mybatis-spring-boot-autoconfigure-2.0.1.jar;C:\Users\amdin\.m2\repository\org\mybatis\mybatis\3.5.1\mybatis-3.5.1.jar;C:\Users\amdin\.m2\repository\org\mybatis\mybatis-spring\2.0.1\mybatis-spring-2.0.1.jar;C:\Users\amdin\.m2\repository\com\alibaba\druid\1.1.16\druid-1.1.16.jar;C:\Users\amdin\.m2\repository\com\microsoft\sqlserver\mssql-jdbc\6.4.0.jre8\mssql-jdbc-6.4.0.jre8.jar;C:\Users\amdin\.m2\repository\org\mybatis\generator\mybatis-generator-core\1.3.7\mybatis-generator-core-1.3.7.jar;C:\Users\amdin\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.1.7.RELEASE\spring-boot-starter-web-2.1.7.RELEASE.jar;C:\Users\amdin\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.1.7.RELEASE\spring-boot-starter-json-2.1.7.RELEASE.jar;C:\Users\amdin\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.9\jackson-datatype-jdk8-2.9.9.jar;C:\Users\amdin\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.9\jackson-datatype-jsr310-2.9.9.jar;C:\Users\amdin\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.9\jackson-module-parameter-names-2.9.9.jar;C:\Users\amdin\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.1.7.RELEASE\spring-boot-starter-tomcat-2.1.7.RELEASE.jar;C:\Users\amdin\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.22\tomcat-embed-core-9.0.22.jar;C:\Users\amdin\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.22\tomcat-embed-el-9.0.22.jar;C:\Users\amdin\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.22\tomcat-embed-websocket-9.0.22.jar;C:\Users\amdin\.m2\repository\org\hibernate\validator\hibernate-validator\6.0.17.Final\hibernate-validator-6.0.17.Final.jar;C:\Users\amdin\.m2\repository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;C:\Users\amdin\.m2\repository\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;C:\Users\amdin\.m2\repository\com\fasterxml\classmate\1.4.0\classmate-1.4.0.jar;C:\Users\amdin\.m2\repository\org\springframework\spring-web\5.1.9.RELEASE\spring-web-5.1.9.RELEASE.jar;C:\Users\amdin\.m2\repository\org\springframework\spring-beans\5.1.9.RELEASE\spring-beans-5.1.9.RELEASE.jar;C:\Users\amdin\.m2\repository\org\springframework\spring-webmvc\5.1.9.RELEASE\spring-webmvc-5.1.9.RELEASE.jar;C:\Users\amdin\.m2\repository\org\springframework\spring-aop\5.1.9.RELEASE\spring-aop-5.1.9.RELEASE.jar;C:\Users\amdin\.m2\repository\org\springframework\spring-context\5.1.9.RELEASE\spring-context-5.1.9.RELEASE.jar;C:\Users\amdin\.m2\repository\org\springframework\spring-expression\5.1.9.RELEASE\spring-expression-5.1.9.RELEASE.jar;C:\Users\amdin\.m2\repository\junit\junit\4.12\junit-4.12.jar;C:\Users\amdin\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;C:\Users\amdin\.m2\repository\org\springframework\spring-core\5.1.9.RELEASE\spring-core-5.1.9.RELEASE.jar;C:\Users\amdin\.m2\repository\org\springframework\spring-jcl\5.1.9.RELEASE\spring-jcl-5.1.9.RELEASE.jar;C:\Users\amdin\.m2\repository\org\slf4j\slf4j-api\1.7.26\slf4j-api-1.7.26.jar;C:\Users\amdin\.m2\repository\org\slf4j\log4j-over-slf4j\1.7.26\log4j-over-slf4j-1.7.26.jar;C:\Users\amdin\.m2\repository\org\slf4j\jcl-over-slf4j\1.7.26\jcl-over-slf4j-1.7.26.jar;C:\Users\amdin\.m2\repository\com\github\pagehelper\pagehelper-spring-boot-starter\1.2.5\pagehelper-spring-boot-starter-1.2.5.jar;C:\Users\amdin\.m2\repository\com\github\pagehelper\pagehelper-spring-boot-autoconfigure\1.2.5\pagehelper-spring-boot-autoconfigure-1.2.5.jar;C:\Users\amdin\.m2\repository\org\apache\commons\commons-lang3\3.9\commons-lang3-3.9.jar;C:\Users\amdin\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.9.8\jackson-databind-2.9.8.jar;C:\Users\amdin\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;C:\Users\amdin\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.9.9\jackson-core-2.9.9.jar;C:\Users\amdin\.m2\repository\org\apache\httpcomponents\httpclient\4.5.8\httpclient-4.5.8.jar;C:\Users\amdin\.m2\repository\org\json\json\20180813\json-20180813.jar;C:\Users\amdin\.m2\repository\commons-fileupload\commons-fileupload\1.4\commons-fileupload-1.4.jar;C:\Users\amdin\.m2\repository\commons-io\commons-io\2.2\commons-io-2.2.jar;C:\Users\amdin\.m2\repository\org\bouncycastle\bcprov-jdk15on\1.61\bcprov-jdk15on-1.61.jar;C:\Users\amdin\.m2\repository\commons-codec\commons-codec\1.12\commons-codec-1.12.jar;C:\Users\amdin\.m2\repository\jdom\jdom\1.0\jdom-1.0.jar;C:\Users\amdin\.m2\repository\com\google\code\gson\gson\2.8.5\gson-2.8.5.jar;C:\Users\amdin\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\amdin\.m2\repository\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar;C:\Users\amdin\.m2\repository\xml-apis\xml-apis\1.4.01\xml-apis-1.4.01.jar;C:\Users\amdin\.m2\repository\org\apache\httpcomponents\httpcore\4.4.11\httpcore-4.4.11.jar;C:\Users\amdin\.m2\repository\org\apache\httpcomponents\httpmime\4.5.8\httpmime-4.5.8.jar;C:\Users\amdin\.m2\repository\com\googlecode\json-simple\json-simple\1.1.1\json-simple-1.1.1.jar;C:\Users\amdin\.m2\repository\org\apache\shiro\shiro-spring\1.3.2\shiro-spring-1.3.2.jar;C:\Users\amdin\.m2\repository\org\apache\shiro\shiro-core\1.3.2\shiro-core-1.3.2.jar;C:\Users\amdin\.m2\repository\commons-beanutils\commons-beanutils\1.8.3\commons-beanutils-1.8.3.jar;C:\Users\amdin\.m2\repository\org\apache\shiro\shiro-web\1.3.2\shiro-web-1.3.2.jar;C:\Users\amdin\.m2\repository\com\github\pagehelper\pagehelper\5.1.2\pagehelper-5.1.2.jar;C:\Users\amdin\.m2\repository\com\github\jsqlparser\jsqlparser\1.0\jsqlparser-1.0.jar" com.example.kexie.KexieApplication 17:55:12.366 [main] DEBUG org.springframework.boot.context.logging.ClasspathLoggingApplicationListener - Application failed to start with classpath: [file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/charsets.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/deploy.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/ext/access-bridge-64.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/ext/cldrdata.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/ext/dnsns.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/ext/jaccess.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/ext/jfxrt.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/ext/localedata.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/ext/nashorn.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/ext/sunec.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/ext/sunjce_provider.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/ext/sunmscapi.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/ext/sunpkcs11.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/ext/zipfs.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/javaws.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/jce.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/jfr.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/jfxswt.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/jsse.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/management-agent.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/plugin.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/resources.jar, file:/C:/Program%20Files/Java/jdk1.8.0_121/jre/lib/rt.jar, file:/E:/maven/kexie/target/classes/, file:/C:/Users/amdin/.m2/repository/org/springframework/boot/spring-boot-starter-thymeleaf/2.1.7.RELEASE/spring-boot-starter-thymeleaf-2.1.7.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/org/springframework/boot/spring-boot-starter/2.1.7.RELEASE/spring-boot-starter-2.1.7.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/org/springframework/boot/spring-boot/2.1.7.RELEASE/spring-boot-2.1.7.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.1.7.RELEASE/spring-boot-autoconfigure-2.1.7.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.1.7.RELEASE/spring-boot-starter-logging-2.1.7.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar, file:/C:/Users/amdin/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar, file:/C:/Users/amdin/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.11.2/log4j-to-slf4j-2.11.2.jar, file:/C:/Users/amdin/.m2/repository/org/apache/logging/log4j/log4j-api/2.11.2/log4j-api-2.11.2.jar, file:/C:/Users/amdin/.m2/repository/org/slf4j/jul-to-slf4j/1.7.26/jul-to-slf4j-1.7.26.jar, file:/C:/Users/amdin/.m2/repository/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar, file:/C:/Users/amdin/.m2/repository/org/yaml/snakeyaml/1.23/snakeyaml-1.23.jar, file:/C:/Users/amdin/.m2/repository/org/thymeleaf/thymeleaf-spring5/3.0.11.RELEASE/thymeleaf-spring5-3.0.11.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/org/thymeleaf/thymeleaf/3.0.11.RELEASE/thymeleaf-3.0.11.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/org/attoparser/attoparser/2.0.5.RELEASE/attoparser-2.0.5.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/org/unbescape/unbescape/1.1.6.RELEASE/unbescape-1.1.6.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/org/thymeleaf/extras/thymeleaf-extras-java8time/3.0.4.RELEASE/thymeleaf-extras-java8time-3.0.4.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/org/mybatis/spring/boot/mybatis-spring-boot-starter/2.0.1/mybatis-spring-boot-starter-2.0.1.jar, file:/C:/Users/amdin/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/2.1.7.RELEASE/spring-boot-starter-jdbc-2.1.7.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/com/zaxxer/HikariCP/3.2.0/HikariCP-3.2.0.jar, file:/C:/Users/amdin/.m2/repository/org/springframework/spring-jdbc/5.1.9.RELEASE/spring-jdbc-5.1.9.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/org/springframework/spring-tx/5.1.9.RELEASE/spring-tx-5.1.9.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/org/mybatis/spring/boot/mybatis-spring-boot-autoconfigure/2.0.1/mybatis-spring-boot-autoconfigure-2.0.1.jar, file:/C:/Users/amdin/.m2/repository/org/mybatis/mybatis/3.5.1/mybatis-3.5.1.jar, file:/C:/Users/amdin/.m2/repository/org/mybatis/mybatis-spring/2.0.1/mybatis-spring-2.0.1.jar, file:/C:/Users/amdin/.m2/repository/com/alibaba/druid/1.1.16/druid-1.1.16.jar, file:/C:/Users/amdin/.m2/repository/com/microsoft/sqlserver/mssql-jdbc/6.4.0.jre8/mssql-jdbc-6.4.0.jre8.jar, file:/C:/Users/amdin/.m2/repository/org/mybatis/generator/mybatis-generator-core/1.3.7/mybatis-generator-core-1.3.7.jar, file:/C:/Users/amdin/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.1.7.RELEASE/spring-boot-starter-web-2.1.7.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.1.7.RELEASE/spring-boot-starter-json-2.1.7.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.9/jackson-datatype-jdk8-2.9.9.jar, file:/C:/Users/amdin/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.9/jackson-datatype-jsr310-2.9.9.jar, file:/C:/Users/amdin/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.9/jackson-module-parameter-names-2.9.9.jar, file:/C:/Users/amdin/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.1.7.RELEASE/spring-boot-starter-tomcat-2.1.7.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.22/tomcat-embed-core-9.0.22.jar, file:/C:/Users/amdin/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.22/tomcat-embed-el-9.0.22.jar, file:/C:/Users/amdin/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.22/tomcat-embed-websocket-9.0.22.jar, file:/C:/Users/amdin/.m2/repository/org/hibernate/validator/hibernate-validator/6.0.17.Final/hibernate-validator-6.0.17.Final.jar, file:/C:/Users/amdin/.m2/repository/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar, file:/C:/Users/amdin/.m2/repository/org/jboss/logging/jboss-logging/3.3.2.Final/jboss-logging-3.3.2.Final.jar, file:/C:/Users/amdin/.m2/repository/com/fasterxml/classmate/1.4.0/classmate-1.4.0.jar, file:/C:/Users/amdin/.m2/repository/org/springframework/spring-web/5.1.9.RELEASE/spring-web-5.1.9.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/org/springframework/spring-beans/5.1.9.RELEASE/spring-beans-5.1.9.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/org/springframework/spring-webmvc/5.1.9.RELEASE/spring-webmvc-5.1.9.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/org/springframework/spring-aop/5.1.9.RELEASE/spring-aop-5.1.9.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/org/springframework/spring-context/5.1.9.RELEASE/spring-context-5.1.9.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/org/springframework/spring-expression/5.1.9.RELEASE/spring-expression-5.1.9.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/junit/junit/4.12/junit-4.12.jar, file:/C:/Users/amdin/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar, file:/C:/Users/amdin/.m2/repository/org/springframework/spring-core/5.1.9.RELEASE/spring-core-5.1.9.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/org/springframework/spring-jcl/5.1.9.RELEASE/spring-jcl-5.1.9.RELEASE.jar, file:/C:/Users/amdin/.m2/repository/org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26.jar, file:/C:/Users/amdin/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.26/log4j-over-slf4j-1.7.26.jar, file:/C:/Users/amdin/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.26/jcl-over-slf4j-1.7.26.jar, file:/C:/Users/amdin/.m2/repository/com/github/pagehelper/pagehelper-spring-boot-starter/1.2.5/pagehelper-spring-boot-starter-1.2.5.jar, file:/C:/Users/amdin/.m2/repository/com/github/pagehelper/pagehelper-spring-boot-autoconfigure/1.2.5/pagehelper-spring-boot-autoconfigure-1.2.5.jar, file:/C:/Users/amdin/.m2/repository/org/apache/commons/commons-lang3/3.9/commons-lang3-3.9.jar, file:/C:/Users/amdin/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.8/jackson-databind-2.9.8.jar, file:/C:/Users/amdin/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar, file:/C:/Users/amdin/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.9.9/jackson-core-2.9.9.jar, file:/C:/Users/amdin/.m2/repository/org/apache/httpcomponents/httpclient/4.5.8/httpclient-4.5.8.jar, file:/C:/Users/amdin/.m2/repository/org/json/json/20180813/json-20180813.jar, file:/C:/Users/amdin/.m2/repository/commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4.jar, file:/C:/Users/amdin/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.jar, file:/C:/Users/amdin/.m2/repository/org/bouncycastle/bcprov-jdk15on/1.61/bcprov-jdk15on-1.61.jar, file:/C:/Users/amdin/.m2/repository/commons-codec/commons-codec/1.12/commons-codec-1.12.jar, file:/C:/Users/amdin/.m2/repository/jdom/jdom/1.0/jdom-1.0.jar, file:/C:/Users/amdin/.m2/repository/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar, file:/C:/Users/amdin/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar, file:/C:/Users/amdin/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar, file:/C:/Users/amdin/.m2/repository/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar, file:/C:/Users/amdin/.m2/repository/org/apache/httpcomponents/httpcore/4.4.11/httpcore-4.4.11.jar, file:/C:/Users/amdin/.m2/repository/org/apache/httpcomponents/httpmime/4.5.8/httpmime-4.5.8.jar, file:/C:/Users/amdin/.m2/repository/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar, file:/C:/Users/amdin/.m2/repository/org/apache/shiro/shiro-spring/1.3.2/shiro-spring-1.3.2.jar, file:/C:/Users/amdin/.m2/repository/org/apache/shiro/shiro-core/1.3.2/shiro-core-1.3.2.jar, file:/C:/Users/amdin/.m2/repository/commons-beanutils/commons-beanutils/1.8.3/commons-beanutils-1.8.3.jar, file:/C:/Users/amdin/.m2/repository/org/apache/shiro/shiro-web/1.3.2/shiro-web-1.3.2.jar, file:/C:/Users/amdin/.m2/repository/com/github/pagehelper/pagehelper/5.1.2/pagehelper-5.1.2.jar, file:/C:/Users/amdin/.m2/repository/com/github/jsqlparser/jsqlparser/1.0/jsqlparser-1.0.jar, file:/E:/IDEA2018.2.3/lib/idea_rt.jar] 17:55:12.492 [background-preinit] DEBUG org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator - Loaded expression factory via original TCCL 17:55:12.497 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator as ValidatorFactory-scoped message interpolator. 17:55:12.498 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.resolver.TraverseAllTraversableResolver as ValidatorFactory-scoped traversable resolver. 17:55:12.498 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.util.ExecutableParameterNameProvider as ValidatorFactory-scoped parameter name provider. 17:55:12.498 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.DefaultClockProvider as ValidatorFactory-scoped clock provider. 17:55:12.498 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.scripting.DefaultScriptEvaluatorFactory as ValidatorFactory-scoped script evaluator factory. 17:55:12.755 [main] ERROR org.springframework.boot.SpringApplication - Application run failed java.lang.IllegalStateException: Failed to load property source from location 'classpath:/application.yml' at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:525) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadForFileExtension(ConfigFileApplicationListener.java:474) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:444) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$null$6(ConfigFileApplicationListener.java:426) at java.lang.Iterable.forEach(Iterable.java:75) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$load$7(ConfigFileApplicationListener.java:426) at java.lang.Iterable.forEach(Iterable.java:75) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:423) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:322) at org.springframework.boot.context.config.ConfigFileApplicationListener.addPropertySources(ConfigFileApplicationListener.java:203) at org.springframework.boot.context.config.ConfigFileApplicationListener.postProcessEnvironment(ConfigFileApplicationListener.java:187) at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEnvironmentPreparedEvent(ConfigFileApplicationListener.java:177) at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEvent(ConfigFileApplicationListener.java:165) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127) at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:76) at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:53) at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:341) at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1214) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1203) at com.example.kexie.KexieApplication.main(KexieApplication.java:14) Caused by: org.yaml.snakeyaml.error.YAMLException: java.nio.charset.MalformedInputException: Input length = 1 at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:218) at org.yaml.snakeyaml.reader.StreamReader.ensureEnoughData(StreamReader.java:176) at org.yaml.snakeyaml.reader.StreamReader.ensureEnoughData(StreamReader.java:171) at org.yaml.snakeyaml.reader.StreamReader.peek(StreamReader.java:126) at org.yaml.snakeyaml.scanner.ScannerImpl.scanToNextToken(ScannerImpl.java:1177) at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:287) at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:227) at org.yaml.snakeyaml.parser.ParserImpl$ParseImplicitDocumentStart.produce(ParserImpl.java:195) at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158) at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:148) at org.yaml.snakeyaml.composer.Composer.checkNode(Composer.java:72) at org.yaml.snakeyaml.constructor.BaseConstructor.checkData(BaseConstructor.java:112) at org.yaml.snakeyaml.Yaml$1.hasNext(Yaml.java:542) at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:160) at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:134) at org.springframework.boot.env.OriginTrackedYamlLoader.load(OriginTrackedYamlLoader.java:75) at org.springframework.boot.env.YamlPropertySourceLoader.load(YamlPropertySourceLoader.java:50) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadDocuments(ConfigFileApplicationListener.java:543) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:498) ... 23 common frames omitted Caused by: java.nio.charset.MalformedInputException: Input length = 1 at java.nio.charset.CoderResult.throwException(CoderResult.java:281) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:339) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178) at java.io.InputStreamReader.read(InputStreamReader.java:184) at org.yaml.snakeyaml.reader.UnicodeReader.read(UnicodeReader.java:125) at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:183) ... 41 common frames omitted Process finished with exit code 1 ``` ## yml文件 ![图片说明](https://img-ask.csdn.net/upload/201908/26/1566781610_481748.png)
spring boot打开网页错误500,错误信息如下,怎么解决?
2019-04-26 12:59:31.688 INFO 11188 --- [p-nio-80-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 2019-04-26 12:59:31.688 INFO 11188 --- [p-nio-80-exec-2] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 2019-04-26 12:59:31.693 INFO 11188 --- [p-nio-80-exec-2] o.s.web.servlet.DispatcherServlet : Completed initialization in 5 ms 2019-04-26 12:59:31.994 ERROR 11188 --- [p-nio-80-exec-2] org.thymeleaf.TemplateEngine : [THYMELEAF][http-nio-80-exec-2] Exception processing template "index": An error happened during template parsing (template: "class path resource [templates/index.html]") org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/index.html]") 2019-04-26 12:59:32.001 ERROR 11188 --- [p-nio-80-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.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/index.html]")] with root cause org.springframework.expression.spel.SpelEvaluationException: EL1012E: Cannot index into a null value ``` <!DOCTYPE html> <html lang="zh" xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="renderer" content="webkit"> <title>车联网监测系统</title> <meta name="keywords" content="车联网监测系统"> <meta name="description" content="车联网监测系统"> <!--[if lt IE 9]> <meta http-equiv="refresh" content="0;ie.html"/> <![endif]--> </head> <link th:href="@{/css/bootstrap.css}" rel="stylesheet"/> <link th:href="@{/css/base.css}" rel="stylesheet"/> <link th:href="@{/css/index.css}" rel="stylesheet"/> <style> .t_title { width: 100%; height: 100%; text-align: center; font-size: 2.5em; line-height: 80px; color: #fff; } #chart_map { cursor: pointer; } .t_show { position: absolute; top: 0; right: 0; border-radius: 2px; background: #2C58A6; padding: 2px 5px; color: #fff; cursor: pointer; } </style> <body> <div> <div class="header"> <div class="bg_header"> <div class="header_nav fl t_title"> 车辆运行监测系统 </div> </div> </div> <div class="data_content"> <div class="data_main" > <div class="main_left fl" style="height: 610px;" > <div class="left_1 " style="height: 100%;" > <!--左上边框--> <div class="t_line_box"> <i class="t_l_line"></i> <i class="l_t_line"></i> </div> <!--右上边框--> <div class="t_line_box"> <i class="t_r_line"></i> <i class="r_t_line"></i> </div> <!--左下边框--> <div class="t_line_box"> <i class="l_b_line"></i> <i class="b_l_line"></i> </div> <!--右下边框--> <div class="t_line_box"> <i class="r_b_line"></i> <i class="b_r_line"></i> </div> <div class="main_title"> <img src="img/t_1.png" alt=""> 所有车辆信息 </div> <div style="width:100%;height: 100%;"> <div style="width: 100%;margin-top: 20%;text-align: center;" th:each="data:${list}" > <a th:onclick="'javascript:select('+${data.id}+');'"> <p style="color: #0BFA00;font-size: 20px;" >[[${data.name}]]</p></a> </div> </div> </div> </div> <div class="main_center fl"> <div class="center_text"> <!--左上边框--> <div class="t_line_box"> <i class="t_l_line"></i> <i class="l_t_line"></i> </div> <!--右上边框--> <div class="t_line_box"> <i class="t_r_line"></i> <i class="r_t_line"></i> </div> <!--左下边框--> <div class="t_line_box"> <i class="l_b_line"></i> <i class="b_l_line"></i> </div> <!--右下边框--> <div class="t_line_box"> <i class="r_b_line"></i> <i class="b_r_line"></i> </div> <div class="main_title"> <img src="img/t_3.png" alt="">车辆运行轨迹图 </div> <div id="chart_map" style="width:100%;height:610px;"></div> </div> </div> <div class="main_right fr" style="height: 610px;"> <div class="right_1" style="height: 100%;"> <!--左上边框--> <div class="t_line_box"> <i class="t_l_line"></i> <i class="l_t_line"></i> </div> <!--右上边框--> <div class="t_line_box"> <i class="t_r_line"></i> <i class="r_t_line"></i> </div> <!--左下边框--> <div class="t_line_box"> <i class="l_b_line"></i> <i class="b_l_line"></i> </div> <!--右下边框--> <div class="t_line_box"> <i class="r_b_line"></i> <i class="b_r_line"></i> </div> <div class="main_title"> <img src="img/t_4.png" alt="">车辆运行信息 </div> <div id="chart_3" class="echart t_btn7" style="width:100%;height: 100%;text-align: center;font-size: 13px;color: #0BFA00;" > <p><span style="color: white">急转弯次数:</span><span id="sharpturntime">[[${list[0].sharpturntime}]]</span> <span style="color: white">ESC防侧翻是否被激活:</span><span id="escantirollover">[[${list[0].escantirollover}]]</span></p> <p><span style="color: white">ESC方向控制是否激活:</span><span id="escdirectionalcontrol">[[${list[0].escdirectionalcontrol}]]</span><span style="color: white">侧向加速度:</span><span id="lateralacceleration">[[${list[0].lateralacceleration}]]</span></p> <p><span style="color: white">纵向加速度:</span><span id="forwardacceleration">[[${list[0].forwardacceleration}]]</span><span style="color: white">制动踏板深度:</span><span id="footstepdepth">[[${list[0].footstepdepth}]]</span></p> <p><span style="color: white">与前车距离:</span><span id="distancefrontcar">[[${list[0].distancefrontcar}]]</span><span style="color: white">前车速度:</span><span id="frontcarspeed">[[${list[0].frontcarspeed}]]</span></p> <p><span style="color: white">与前车碰撞时间:</span><span id="collidetime">[[${list[0].collidetime}]]</span><span style="color: white">acc是否被激活:</span><span id="accflag">[[${list[0].accflag}]]</span></p> <p><span style="color: white">aebss给ebs发制动信号:</span><span id="aebstoebs">[[${list[0].aebstoebs}]]</span><span style="color: white">车道压线次数:</span><span id="lanepressline">[[${list[0].lanepressline}]]</span></p> <p><span style="color: white">显示是否换挡:</span><span id="shift">[[${list[0].shift}]]</span><span style="color: white">车辆行驶高度:</span><span id="carheight">[[${list[0].carheight}]]</span></p> <p><span style="color: white">牵引车重:</span><span id="carweight">[[${list[0].carweight}]]</span><span style="color: white">挂车防侧翻功能是否被启动:</span><span id="rss">[[${list[0].rss}]]</span></p> <p><span style="color: white">车速:</span><span id="carspeed">[[${list[0].carspeed}]]</span></p> <p><span style="color: white">车辆载重:</span><span id="carload">[[${list[0].carload}]]</span></p> <p><span style="color: white">货物重量:</span><span id="cargoweight">[[${list[0].cargoweight}]]</span></p> <p><span style="color: white">挂车是否被锁定:</span><span id="islock">[[${list[0].islock}]]</span></p> <p><span style="color: white">tesbs是否正常(红黄绿):</span><span id="tebsnormal">[[${list[0].tebsnormal}]]</span></p> <p><span style="color: white">tebs错误代码:</span><span id="tebserr">[[${list[0].tebserr}]]</span></p> <p><span style="color: white">胎温胎压:</span><span id="temppre">[[${list[0].temppre}]]</span></p> <p><span style="color: white">车尾防撞系统是否被激活:</span><span id="trailcrashproof">[[${list[0].trailcrashproof}]]</span></p> <p><span style="color: white">紧急刹车提醒是否被激活:</span><span id="brakewarn">[[${list[0].brakewarn}]]</span></p> <p><span style="color: white">车辆保修提醒:</span><span id="repairremind">[[${list[0].repairremind}]]</span></p> </div> </div> </div> </div> </div> </div> <script src="../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script> <script th:src="@{js/bootstrap.min.js}"></script> <script th:src="@{js/common.js}"></script> <script th:src="@{js/echarts.min.js}"></script> <script th:src="@{js/dataTool.js}"></script> <script th:src="@{js/index.js}"></script> <script th:src="@{js/china.js}"></script> <script th:src="@{js/hunan.js}"></script> <!--<script>--> <!--// var list = [[${list}]];--> <!--function rawGnssList () {--> <!--$.ajax({--> <!--cache: true,--> <!--type: "POST",--> <!--url: "/abc",--> <!--success: function (ret) {--> <!--alert(ret);--> <!--var data = JSON.stringify(ret);--> <!--alert(dat[0].iD);--> <!--}--> <!--});--> <!--}--> <!--</script>--> <script th:inline="javascript"> function select(id){ var list = [[${list}]]; var carinfo1 = list[id-1]; document.getElementById("cargoweight").innerHTML=carinfo1.cargoweight; document.getElementById("islock").innerHTML=carinfo1.islock; document.getElementById("tebsnormal").innerHTML=carinfo1.tebsnormal; document.getElementById("tebserr").innerHTML=carinfo1.tebserr; document.getElementById("temppre").innerHTML=carinfo1.temppre; document.getElementById("trailcrashproof").innerHTML=carinfo1.trailcrashproof; document.getElementById("brakewarn").innerHTML=carinfo1.brakewarn; document.getElementById("repairremind").innerHTML=carinfo1.repairremind; document.getElementById("sharpturntime").innerHTML=carinfo1.sharpturntime; document.getElementById("escantirollover").innerHTML=carinfo1.escantirollover; document.getElementById("escdirectionalcontrol").innerHTML=carinfo1.escdirectionalcontrol; document.getElementById("lateralacceleration").innerHTML=carinfo1.lateralacceleration; document.getElementById("forwardacceleration").innerHTML=carinfo1.forwardacceleration; document.getElementById("footstepdepth").innerHTML=carinfo1.footstepdepth; document.getElementById("distancefrontcar").innerHTML=carinfo1.distancefrontcar; document.getElementById("frontcarspeed").innerHTML=carinfo1.frontcarspeed; document.getElementById("collidetime").innerHTML=carinfo1.collidetime; document.getElementById("accflag").innerHTML=carinfo1.accflag; document.getElementById("aebstoebs").innerHTML=carinfo1.aebstoebs; document.getElementById("lanepressline").innerHTML=carinfo1.lanepressline; document.getElementById("shift").innerHTML=carinfo1.shift; document.getElementById("carheight").innerHTML=carinfo1.carheight; document.getElementById("carweight").innerHTML=carinfo1.carweight; document.getElementById("rss").innerHTML=carinfo1.rss; document.getElementById("carspeed").innerHTML=carinfo1.carspeed; document.getElementById("carload").innerHTML=carinfo1.carload; document.getElementById("laterala").innerHTML=carinfo1.laterala; } </script> </body> </html> ```
thymeleaf th:text的值没有数据时报错问题
# thymeleaf th:text的值没有数据时报错问题 求解 怎么让th:text没有数据传过来时不报错
springboot配置thymeleaf
application.properties: ``` #thymeleaf spring.thymeleaf.prefix=classpath:/templates/ spring.thymeleaf.suffix=.html spring.thymeleaf.mode=HTML spring.thymeleaf.encoding=UTF-8 spring.thymeleaf.contentType=text/html spring.thymeleaf.cache=false ``` 视图返回: ``` /** * * @param registry */ @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/user/login").setViewName("canal/user/login"); registry.addViewController("/user/index").setViewName("canal/user/user_index"); } ``` 结构目录: ![图片说明](https://img-ask.csdn.net/upload/201808/06/1533542523_271145.png) 报警告: ``` 2018-08-06 15:46:12.829 INFO 4416 --- [ main] o.s.w.s.h.SimpleUrlHandlerMapping : Mapped URL path [/user/login] onto handler of type [class org.springframework.web.servlet.mvc.ParameterizableViewController] 2018-08-06 15:46:12.829 INFO 4416 --- [ main] o.s.w.s.h.SimpleUrlHandlerMapping : Mapped URL path [/user/index] onto handler of type [class org.springframework.web.servlet.mvc.ParameterizableViewController] 2018-08-06 15:46:12.838 INFO 4416 --- [ main] o.s.w.s.h.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-08-06 15:46:12.839 INFO 4416 --- [ main] o.s.w.s.h.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-08-06 15:46:12.839 INFO 4416 --- [ main] o.s.w.s.h.SimpleUrlHandlerMapping : Mapped URL path [/static/canal/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-08-06 15:46:12.893 WARN 4416 --- [ main] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration) 2018-08-06 15:46:13.167 INFO 4416 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2018-08-06 15:46:13.169 INFO 4416 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'druidDataSource' has been autodetected for JMX exposure 2018-08-06 15:46:13.178 INFO 4416 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located MBean 'druidDataSource': registering with JMX server as MBean [com.alibaba.druid.pool:name=druidDataSource,type=DruidDataSource] 2018-08-06 15:46:13.231 INFO 4416 --- [ main] o.s.b.w.e.t.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '/CANAL' 2018-08-06 15:46:13.237 INFO 4416 --- [ main] c.Application : Started Application in 3.552 seconds (JVM running for 4.212) ``` 访问: localhost:8080/CANAL/user/login 出现: ``` 2018-08-06 16:03:36.778 ERROR 4416 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[.[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [/CANAL] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: Error resolving template "canal/user/login", template might not exist or might not be accessible by any of the configured Template Resolvers] with root cause org.thymeleaf.exceptions.TemplateInputException: Error resolving template "canal/user/login", template might not exist or might not be accessible by any of the configured Template Resolvers at org.thymeleaf.engine.TemplateManager.resolveTemplate(TemplateManager.java:870) ~[thymeleaf-3.0.9.RELEASE.jar:3.0.9.RELEASE] at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:607) ~[thymeleaf-3.0.9.RELEASE.jar:3.0.9.RELEASE] at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098) ~[thymeleaf-3.0.9.RELEASE.jar:3.0.9.RELEASE] at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072) ~[thymeleaf-3.0.9.RELEASE.jar:3.0.9.RELEASE] at org.thymeleaf.spring5.view.ThymeleafView.renderFragment(ThymeleafView.java:354) ~[thymeleaf-spring5-3.0.9.RELEASE.jar:3.0.9.RELEASE] at org.thymeleaf.spring5.view.ThymeleafView.render(ThymeleafView.java:187) ~[thymeleaf-spring5-3.0.9.RELEASE.jar:3.0.9.RELEASE] at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1325) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1069) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE] ```
IDEA环境Springboot2.2.1进行Web开发,自定义pesonal.yml文件读取不到value值
先看下文件位置: ![图片说明](https://img-ask.csdn.net/upload/202001/22/1579675010_950804.png) 文件内容如下: ```yaml jwt: # 加密私钥 secret: bensu[sentiment] # header名称 header: token # 有效时长7天(7*24*60*60) expire: 604800 ``` 项目依赖关系如下: ```xml <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>org.thymeleaf</groupId> <artifactId>thymeleaf</artifactId> </dependency> <!-- SpringBoot Web 依赖 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>2.1.1</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> </dependency> <!--JSP依赖--> <!--dependency>--> <!--<groupId>org.apache.tomcat.embed</groupId>--> <!--<artifactId>tomcat-embed-jasper</artifactId>--> <!--</dependency>--> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> <!-- 数据库访问控制依赖 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>org.webjars</groupId> <artifactId>bootstrap</artifactId> <version>4.4.1</version> </dependency> <!-- https://mvnrepository.com/artifact/org.webjars.bower/jquery --> <dependency> <groupId>org.webjars.bower</groupId> <artifactId>jquery</artifactId> <version>3.4.1</version> </dependency> <dependency> <groupId>org.fusesource</groupId> <artifactId>sigar</artifactId> <version>1.6.4</version> </dependency> <dependency> <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt</artifactId> <version>0.9.0</version> </dependency> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.4</version> </dependency> </dependencies> ``` 绑定实体类代码如下: ```java @Component @PropertySource("classpath:personal.yml") @ConfigurationProperties(prefix = "jwt") public class TokenDomain { // header名称 @Value(value = "${header}") private String header; // 密钥 @Value(value = "${secret}") private String secret; // 有效时长 @Value(value = "${expire}") private long expire; public String getHeader() { return header; } public void setHeader(String header) { this.header = header; } public String getSecret() { return secret; } public void setSecret(String secret) { this.secret = secret; } public long getExpire() { return expire; } public void setExpire(long expire) { this.expire = expire; } } ``` 调用该实体类代码如下: ```java @Autowired private TokenDomain tokenDomain; /** * 根据身份ID标识,生成Token * @param userId 根据身份ID标识 * @param pwd 密码 * @return Token 字串 */ public String createToken(String userId,String pwd){ //过期时间,精确到毫秒 Date expireDate = new Date(new Date().getTime() + tokenDomain.getExpire()); // 生成token字串 String token =Jwts.builder() .setHeaderParam("typ","JWT") .setHeaderParam("alg","HS256") .claim("userId",userId) .claim("pwd",pwd) .setSubject(userId+pwd) .setIssuedAt(new Date()) .setExpiration(expireDate) .signWith(SignatureAlgorithm.ES512, tokenDomain.getSecret()) .compact(); return token; } ``` 实体类在Spring测试类中可正常读取: ```java @Autowired TokenDomain token; @Test void getPersonal(){ System.out.println(token); System.out.println(token.getHeader()); System.out.println(token.getSecret()); System.out.println(token.getExpire()); } ``` 测试类返回结果如下: ![图片说明](https://img-ask.csdn.net/upload/202001/22/1579675352_164301.png) 但是,业务逻辑类一直都无法正常读取内容,domain一直为null ![图片说明](https://img-ask.csdn.net/upload/202001/22/1579675405_8772.png) 请高手指点迷津。
在Spring Boot项目中,Thymeleaf如何使用消息表达式(#{})?
``` <select class="col-sm-2 form-control" id="searchPost"> <option value="">请选择</option> <option th:value="#{post.java.value}" th:text="#{post.java.name}"></option> <option th:value="#{post.c.value}" th:text="#{post.c.name}"></option> <option th:value="#{post.oracle.value}" th:text="#{post.oracle.name}"></option> <option th:value="#{post.test.value}" th:text="#{post.test.name}"></option> </select> ``` 引用我resources/templates下的.properties文件中的变量。 但是结果却不能正常显示:`<option value="??post.java.value_zh_CN??">??post.java.name_zh_CN??</option>`
使用Thymeleaf时标签的th:text值不替换,但js是能获取到值的时为什么?
在做一个账号被顶号/被冻结返回登录页面的拦截器, 写了一个返回登录页面的controller,想在返回时候同时提示一下账号退出的原因. 可是从controller传过去的属性在页面上没办法显示.不知道是什么原因. 我的controller代码: ```java @Controller public class RedirectController { @RequestMapping("/backToLogin") public ModelAndView backToLogin() { ModelAndView modelAndView=new ModelAndView(); modelAndView.setViewName("backToLogin"); modelAndView.addObject("msg","后端传值123"); return modelAndView; } } ``` 我的模板页面: ```html <!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd"> <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="UTF-8"> <title>重新登录</title> <script> window.onload=function(){ //alert("账号已退出,请重新登录!"); alert("${msg}"); //window.location.href="../dist/index.html"; } </script> </head> <body> <p th:text="${msg}">P标签默认内容</p> <input value="input默认" th:value="${msg}" /> </body> </html> ``` 启动项目之后,请求/backToLogin页面,显示如下 ![图片说明](https://img-ask.csdn.net/upload/201912/02/1575265487_297084.png) ![图片说明](https://img-ask.csdn.net/upload/201912/02/1575265495_39937.png) 很奇怪,是我哪里写的不对吗?我看官方的例子也是这么写的.... 我的JS里写的alert那里,是获取到后端传过来的msg的,可是标签里面默认的值并不替换是为什么啊... html标签那里xmlns那里也都写了.之前另一个小项目就是这样写的也没什么问题.... 烦请大佬帮我看看 感谢! 配置文件中,spring-thymeleaf相关的内容 ``` spring: # 环境 dev|test|prod profiles: active: dev servlet: multipart: max-file-size: 300MB max-request-size: 1000MB enabled: true jmx: enabled: false thymeleaf: suffix: .html mode: HTML5 encoding: UTF-8 cache: false prefix: classpath:/templates/ mvc: static-path-pattern: /** resources: chain: strategy: content: enabled: true paths: /** freemarker: suffix: .html request-context-attribute: request ``` 找到原因了. 今天没传参试了一下,发现报的错是freemarker的错...发现之前项目里加了freemarker的依赖,配置文件里的suffix也是.html.所以freemarker生效了,thymeleaf不生效... 把suffix改成了.ftl就好了!!!当时依赖和配置文件是从前一个项目搬过来的没仔细看...疏忽了疏忽了...
springboot -- thymeleaf 前端拿不到后台的数据是为什么?
![图片说明](https://img-ask.csdn.net/upload/202001/03/1578031434_457988.png) ++++++++++ 第一次用thymeleaf,依赖是有导入的。 不知道为什么会这样,请大神指教
相见恨晚的超实用网站
相见恨晚的超实用网站 持续更新中。。。
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
python 简易微信实现(注册登录+数据库存储+聊天+GUI+文件传输)
socket+tkinter详解+简易微信实现 历经多天的努力,查阅了许多大佬的博客后终于实现了一个简易的微信O(∩_∩)O~~ 简易数据库的实现 使用pands+CSV实现数据库框架搭建 import socket import threading from pandas import * import pymysql import csv # 创建DataFrame对象 # 存储用户数据的表(...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 演示地点演示 html代码如下` music 这个年纪 七月的风 音乐 ` 然后就是css`*{ margin: 0; padding: 0; text-decoration: none; list-...
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。
数据库优化 - SQL优化
以实际SQL入手,带你一步一步走上SQL优化之路!
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 cpp 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7 p...
通俗易懂地给女朋友讲:线程池的内部原理
餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小型人工智障。 知识可以运用在不同地方,不一定非是天气预报。
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
刷了几千道算法题,这些我私藏的刷题网站都在这里了!
遥想当年,机缘巧合入了 ACM 的坑,周边巨擘林立,从此过上了"天天被虐似死狗"的生活… 然而我是谁,我可是死狗中的战斗鸡,智力不够那刷题来凑,开始了夜以继日哼哧哼哧刷题的日子,从此"读题与提交齐飞, AC 与 WA 一色 ",我惊喜的发现被题虐既刺激又有快感,那一刻我泪流满面。这么好的事儿作为一个正直的人绝不能自己独享,经过激烈的颅内斗争,我决定把我私藏的十几个 T 的,阿不,十几个刷题网...
JavaScript 为什么能活到现在?
作者 | 司徒正美 责编 |郭芮 出品 | CSDN(ID:CSDNnews) JavaScript能发展到现在的程度已经经历不少的坎坷,早产带来的某些缺陷是永久性的,因此浏览器才有禁用JavaScript的选项。甚至在jQuery时代有人问出这样的问题,jQuery与JavaScript哪个快?在Babel.js出来之前,发明一门全新的语言代码代替JavaScript...
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
Nginx 原理和架构
Nginx 是一个免费的,开源的,高性能的 HTTP 服务器和反向代理,以及 IMAP / POP3 代理服务器。Nginx 以其高性能,稳定性,丰富的功能,简单的配置和低资源消耗而闻名。 Nginx 的整体架构 Nginx 里有一个 master 进程和多个 worker 进程。master 进程并不处理网络请求,主要负责调度工作进程:加载配置、启动工作进程及非停升级。worker 进程负责处...
致 Python 初学者
欢迎来到“Python进阶”专栏!来到这里的每一位同学,应该大致上学习了很多 Python 的基础知识,正在努力成长的过程中。在此期间,一定遇到了很多的困惑,对未来的学习方向感到迷茫。我非常理解你们所面临的处境。我从2007年开始接触 python 这门编程语言,从2009年开始单一使用 python 应对所有的开发工作,直至今天。回顾自己的学习过程,也曾经遇到过无数的困难,也曾经迷茫过、困惑过。开办这个专栏,正是为了帮助像我当年一样困惑的 Python 初学者走出困境、快速成长。希望我的经验能真正帮到你
Python 编程开发 实用经验和技巧
Python是一门很灵活的语言,也有很多实用的方法,有时候实现一个功能可以用多种方法实现,我这里总结了一些常用的方法和技巧,包括小数保留指定位小数、判断变量的数据类型、类方法@classmethod、制表符中文对齐、遍历字典、datetime.timedelta的使用等,会持续更新......
吐血推荐珍藏的Visual Studio Code插件
作为一名Java工程师,由于工作需要,最近一个月一直在写NodeJS,这种经历可以说是一部辛酸史了。好在有神器Visual Studio Code陪伴,让我的这段经历没有更加困难。眼看这段经历要告一段落了,今天就来给大家分享一下我常用的一些VSC的插件。 VSC的插件安装方法很简单,只需要点击左侧最下方的插件栏选项,然后就可以搜索你想要的插件了。 下面我们进入正题 Material Theme ...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
开源并不是你认为的那些事
点击上方蓝字 关注我们开源之道导读所以 ————想要理清开源是什么?先要厘清开源不是什么,名正言顺是句中国的古代成语,概念本身的理解非常之重要。大部分生物多样性的起源,...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
Python 植物大战僵尸代码实现(2):植物卡片选择和种植
这篇文章要介绍的是: - 上方植物卡片栏的实现。 - 点击植物卡片,鼠标切换为植物图片。 - 鼠标移动时,判断当前在哪个方格中,并显示半透明的植物作为提示。
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员...
相关热词 基于c#波形控件 c# 十进制转十六进制 对文件aes加密vc# c#读取栈中所有的值 c# rsa256加密 好 学c# 还是c++ c# 和java的差距 c# curl网络框架 c# https证书请求 c# 中崎
立即提问