struts2的s:datetimepicker日期时间标签选择器

struts2框架,为我们提供了时间选择器控件:datetimepicker。

由于版本更新的问题使用过程中会出现的问题,主要就是struts2版本 更新时做了一些修改。

在struts2.0时,使用<s:datetimepicker/>时,需要在<head>< /head>标签中申明:<s:head theme="ajax"/>.

但在struts2.1.6时,struts2就不再单独提供主题ajax,而是将ajax主题整合到dojo包 中。

所以我们在使用struts2.1.6以上版本时,需要导入     struts2-dojo-plugin-2.x.x.jar, 

要在jsp页面中引入dojo的标签库:<%@ taglib="/struts-dodo-tags" prefix="sx"%>,

而将<s:head theme="ajax"/>去掉。直接写上:

<head>中加入下列

<head>
    <s:head theme="xhtml"/>
    <sx:head parseContent="true"/>      
</head>

在使用标签时这样写:<sx:datimepicker name="" displayFormat="yyyy-MM-dd"/>,

还有很多属性可以在struts2帮助文档中查看。而如果在2.0以上版本使用& lt;s:head theme="ajax"/>.将会报以下错误:

Expression parameters.parseContent is undefined on line 45, column 28 in template/ajax/head.ftl。
The problematic instruction:
----------
==> ${parameters.parseContent?string} [on line 45, column 26 in template/ajax/head.ftl]
----------

 注: 导入struts2-dojo-plugin-2.x.x.jar。

原文地址:https://www.cnblogs.com/bsyx/p/4350863.html