当我使用< s:datetextfield />时出现异常标签在jsp [英] Exception occurs when I use <s:datetextfield /> tag in a jsp
问题描述
当我使用标签
<s:datetextfield format="dd-MM-yyyy"></s:datetextfield>
(其中s是struts标签的前缀)我得到一个例外:
(where s is a prefix for struts tag) I get an exception:
org.apache.jasper.JasperException:找不到名为/template/bootstrap/datetextfield.ftl的模板。
org.apache.jasper.JasperException: Template not found for name "/template/bootstrap/datetextfield.ftl".
这里有什么问题?我必须声明/实例化一些日期格式对象并传递它吗?
What is the problem here? Do I have to declare/instantiate some date format object and pass it ?
推荐答案
似乎你使用 struts2-bootstrap-plugin ,带有引导主题;
也似乎引导主题未提供< s:datetextfield />
标签的freemarker模板。
it also seems that the bootstrap theme is unprovided of the freemarker template for the <s:datetextfield />
tag.
遵循逻辑,解决方案是使用一个主题(仅适用于该标签)提供了适当的 .ftl
,在以下方式:
Following the logic, the solution is to use a theme (for that tag only) that is provided of the appropriate .ftl
, in the following way:
<s:datetextfield format="dd-MM-yyyy" theme="simple" />
这是一个非标准的情况...这是我第一次看到它发生。还有一个关于这个的JIRA报告, WW-4434 。
This however is a non-standard situation... it's the first time I see it happens. There is also a JIRA report about this, WW-4434.
我不知道该标签是否已经被使用,并且文档已损坏,但如果只是关于文本框,日期和日期戳记,请考虑使用本机HTML5日期检查器(< s:textfield type =date/>
)与适当后退。
I'm not sure what that tag does since I've neved used it and the documentation is broken, but if it's just about textfields, dates and datepickers, consider using native HTML5 datepickers (<s:textfield type="date"/>
) with appropriate fallbacks.
这篇关于当我使用< s:datetextfield />时出现异常标签在jsp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!