ResultSet有许多Double值字段(具有类似的模式"###0.000").有些值可以null.
我想替换null值"N/A",这是一个String,不能打印到Double字段.打印"0.00"为null值是不可接受的.
使用PrintWhenExpression值($F{value} != null) ? $F{value} : "N/A"不起作用; 不可能以这种方式使用模式.
添加写入"N/A"的隐藏字段.仅当值为时,才会打印这些字段null.
是否有更好的解决方案,如果有,它是什么?
谢谢.
我有一个Spring/JSF Web应用程序,它依赖于模块使用Freemarker模板.这是我为整合做的事情:
我将applicationContext-freemarker-module.xml导入applicationContext.xml我将配置bean添加到applicationContext-freemarker-module.xml,如下所示.
<bean id="freemarkerConfiguration" class="org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean">
<property name="templateLoaderPath" value="classpath*:/"/>
</bean>
Run Code Online (Sandbox Code Playgroud)
我把模板放到freemarker模块的src/main/resources目录下.我正在阅读如下模板:
ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext-freemarker-module.xml");
Configuration templateConfig = (Configuration) context.getBean("freemarkerConfiguration");
Template template = templateConfig.getTemplate("template.ftl");
Run Code Online (Sandbox Code Playgroud)
现在我为templateLoaderPath属性尝试了很多值,但我总是得到"找不到模板".例外.
Freemarker模块的JAR如下所示
template.ftl
applicationContext-freemarker-module.xml
com/.../ (classes)
META-INF
Run Code Online (Sandbox Code Playgroud)
我应该在哪里放模板文件,我应该为templateLoaderPath值设置什么?我无法理解为什么找不到"template.ftl".我试图设置正确的值数小时.我尝试了各种路径配置但没有成功.
非常感谢你的帮助,