草庐IT

ThymeLeaf

全部标签

java - 错误 : Attempted to call method "format" on null context object

Spring-bootv1.4.1Javav1.8Thymeleafv2.1.5。下面这行代码在我看来:它具有我基于S.O.的语法。问题SpringBootThymeleafOrdinalNumbers,产生错误:org.springframework.expression.spel.SpelEvaluationException:EL1011E:(pos11):Methodcall:Attemptedtocallmethodformat(java.time.LocalDate,java.lang.String)onnullcontextobject但是,如果我在没有Thymeleaf

java - Thymeleaf:错误解决模板

我正在尝试将布局/模板与Thymeleaf一起使用,但出现以下异常。Exceptionprocessingtemplate"user/index":Errorresolvingtemplate"/layouts/default.html",templatemightnotexistormightnotbeaccessiblebyanyoftheconfiguredTemplateResolvers这是我的ThymeleafConfig.java@ConfigurationpublicclassThymeleafConfig{@BeanpublicServletContextTempla

java - 如何使用 thymeleaf 作为模板引擎和 Flying Saucer 作为渲染器使用密码保护 pdf 报告

PDF生成成功,但我想用密码保护它。flying-saucer-pdf文档对我没有帮助。我正在使用这个例子Usingthymeleaf+flying-saucer-pdf+SpringBoot 最佳答案 要使用FlyingSaucerPDFCreator在PDF中设置密码,请使用PDFEncryption类。要为您的PDF设置密码,首先创建一个PDFEncryption实例,然后像这样使用它的方法setUserPassword():finalFileoutputFile=File.createTempFile(fileName,".

java - 使用 thymeleaf 模板通过 Spring 发送邮件

我正在尝试使用Thymeleaf模板为Spring应用程序发送邮件,我从这里获取引用https://github.com/thymeleaf/thymeleafexamples-springmail/我没有收到任何错误,但它仍然不起作用。我使用的是与github中给出的代码相同的代码,但仍然没有运气......任何人都可以建议如何做到这一点吗?下面是发送邮件的方法...publicvoidsendSimpleMail(finalStringrecipientName,finalStringrecipientEmail,finalLocalelocale)throwsMessagingE

java - 使用 Thymeleaf 作为模板的 Spring Boot 发送电子邮件 - 配置不起作用

我有一个基于SpringBoot(最新的1.1.5.RELEASE)和Thymeleaf的工作WebApp。现在我想添加发送电子邮件的功能并使用Thymeleaf作为模板引擎。在pom.xml中我添加:org.springframework.integrationspring-integration-mailjavax.mailmail1.4.7javax.activationactivation1.1.1遵循本教程:http://www.thymeleaf.org/doc/articles/springmail.html我得到了这样的完整(无XML)Java配置:@Configura

java - 如何从 Thymeleaf 调用对象的方法?

我的模板看不到从Spring传递的对象。我的代码:publicclassPublicModelAndViewextendsModelAndView{@AutowiredTemplateModulesHandlertemplateModulesHandler;publicvoidinit(){setViewName("index");CSSProcessorcSSProcessor=newCSSProcessor();cSSProcessor.setSiteRegion("public");super.addObject("CSSProcessor",cSSProcessor);JSPr

java - Thymeleaf 3.0 Spring Boot + Security 集成不起作用

我努力让Thymeleaf在我基于SpringBoot1.4.3的项目中与SpringSecurity一起工作。例如标签根本不被解析。如果我尝试像这样手动添加SpringSecurityDialect:@BeanpublicSpringSecurityDialectsecurityDialect(){returnnewSpringSecurityDialect();}我得到:Exceptioninthread"main"java.lang.NoClassDefFoundError:org/thymeleaf/dialect/IExpressionEnhancingDialect我在我的

java - 带有 Thymeleaf 的 utf8 字符集

当将Spring与Thymeleaf一起使用时,我所有的西里尔字符在页面上都显示为??????。使用@RequestMapping(value="/login",method=RequestMethod.GET,produces="text/html;charset=utf-8")正如这里所建议的那样:https://stackoverflow.com/a/11866822/1479414在这里:https://stackoverflow.com/a/12023816/1479414没有帮助。如何解决这个问题? 最佳答案 可以找到答

java - Thymeleaf#lists.contains() 表达式实用程序不工作

我正在使用thymeleaf标准方言并尝试在表单中呈现复选框列表。渲染没问题,但是,问题是我尝试使用thymeleaf#lists.contains()表达式实用程序方法将“checked”属性应用于复选框。所以我有一个包含以下字段的模型类:privateListtemplates;@FormParam("selectedTemplates")privateListselectedTemplates=Lists.newArrayList();Thymeleaf模板html片段:应选中的复选框之一的页面输出。(TemplateName)[4,5]4false如您所见,我打印了具有值[4,

java - 在 Spring 表达式语言中访问属性文件

我使用Thymeleaf使用SpringBoot创建了一个简单的Web应用程序。我使用application.properties文件作为配置。我想要做的是向该文件添加新属性,例如名称和版本,并从Thymeleaf访问这些值。我已经能够通过创建一个新的JavaConfiguration类并公开一个SpringBean来实现这一点:@ConfigurationpublicclassApplicationConfiguration{@Value("${name}")privateStringname;@BeanpublicStringname(){returnname;}}然后我可以像这样