struts2.1.6 出现No tag "datetimepicker" defined in tag library imported with prefix "s" 错误提示
原因:struts2.1.6 把struts2.0中的和ajax相关的,如datetimepicker,tree,treenode 都移动到了dojo中了
解决方法:
1、在jsp文件中加入<%@ taglib uri="/struts-dojo-tags" prefix="sx"%>和<sx:head/>
2、将<s:datetimepicker label="XXXX" name="XXXX"></s:datetimepicker>改为<sx:datetimepicker label="XXXX" name="XXXX"></sx:datetimepicker>
3、将struts2-dojo-plugin-2.1.6.jar拷贝到/web-inf/lib下
用struts2.1.6的datetimepicker时,显示的时候月份从一月到八月都可以正常显示,而到九月,十月就乱码
这是 2.1.6 的一个 bug
解决办法:
1,这个方法可以解决乱码,但是 月份 都变成 1,2,3.... 了
在 <sd:head /> 中加入:extraLocales="UTF-8"
在 <sd:datetimepicker .../> 中加入:language="UTF-8"
2,但是这个方法本人测试没有通过,不知道为什么,应该是可以的。
重新修改struts源码中的 dojo_zh.js和dojo_zh-cn.js文件
文件位置在: struts2-dojo-plugin-2.1.6.jar\org.apache.struts2\static\dojo\nls\下
(可以用rar工具打开,先把dojo_zh.js和dojo_zh-cn.js拖拽出来修改过去,再拖拽进去即可!)
dojo.provide("nls.dojo_zh");dojo.provide("dojo.i18n.calendar.nls.gregorian");dojo.i18n.calendar.nls.gregorian._built=true;dojo.provide("dojo.i18n.calendar.nls.gregorian.zh");dojo.i18n.calendar.nls.gregorian.zh={"days-standAlone-narrow":["日","一","二","三","四","五","六"],"eras":["公元前","公元"],"am":"上午","months-format-abbr":["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],"days-format-abbr":["周日","周一","周二","周三","周四","周五","周六"],"pm":"下午","months-format-wide":["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],"months-standAlone-narrow":["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],"days-format-wide":["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],"field-weekday":"Day of the Week","dateFormat-medium":"yyyy MMM d","field-second":"Second","field-week":"Week","timeFormat-full":"HH:mm:ss z","field-year":"Year","field-minute":"Minute","timeFormat-medium":"HH:mm:ss","field-hour":"Hour","dateFormat-long":"yyyy MMMM d","field-day":"Day","field-dayperiod":"Dayperiod","field-month":"Month","dateFormat-short":"yy/MM/dd","field-era":"Era","timeFormat-short":"HH:mm","timeFormat-long":"HH:mm:ss z","dateFormat-full":"EEEE, yyyy MMMM dd","field-zone":"Zone"};dojo.provide("dojo.i18n.calendar.nls.gregorianExtras");dojo.i18n.calendar.nls.gregorianExtras._built=true;dojo.provide("dojo.i18n.calendar.nls.gregorianExtras.zh");dojo.i18n.calendar.nls.gregorianExtras.zh={"dateFormat-yearOnly":"yyyy'年'"};dojo.provide("dojo.i18n.calendar.nls.gregorian");dojo.i18n.calendar.nls.gregorian._built=true;dojo.provide("dojo.i18n.calendar.nls.gregorian.zh");dojo.i18n.calendar.nls.gregorian.zh={"days-standAlone-narrow":["日","一","二","三","四","五","六"],"eras":["公元前","公元"],"am":"上午","months-format-abbr":["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],"days-format-abbr":["周日","周一","周二","周三","周四","周五","周六"],"pm":"下午","months-format-wide":["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],"months-standAlone-narrow":["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],"days-format-wide":["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],"field-weekday":"Day of the Week","dateFormat-medium":"yyyy MMM d","field-second":"Second","field-week":"Week","timeFormat-full":"HH:mm:ss z","field-year":"Year","field-minute":"Minute","timeFormat-medium":"HH:mm:ss","field-hour":"Hour","dateFormat-long":"yyyy MMMM d","field-day":"Day","field-dayperiod":"Dayperiod","field-month":"Month","dateFormat-short":"yy/MM/dd","field-era":"Era","timeFormat-short":"HH:mm","timeFormat-long":"HH:mm:ss z","dateFormat-full":"EEEE, yyyy MMMM dd","field-zone":"Zone"};dojo.provide("dojo.widget.nls.TimePicker");dojo.widget.nls.TimePicker._built=true;dojo.provide("dojo.widget.nls.TimePicker.zh");dojo.widget.nls.TimePicker.zh={"any":"any"};dojo.provide("dojo.widget.nls.DropdownTimePicker");dojo.widget.nls.DropdownTimePicker._built=true;dojo.provide("dojo.widget.nls.DropdownTimePicker.zh");dojo.widget.nls.DropdownTimePicker.zh={"selectTime":"Select time"};dojo.provide("dojo.widget.nls.DropdownDatePicker");dojo.widget.nls.DropdownDatePicker._built=true;dojo.provide("dojo.widget.nls.DropdownDatePicker.zh");dojo.widget.nls.DropdownDatePicker.zh={"selectDate":"Select a date"};