我想在用户的TimeZone
上使用不同的TimeZone
。
问题:是否有任何功能可以在JSF
或Seam
中设置默认值?
它将影响整个应用程序。
我希望,每次使用时都不会使用s:convertDateTime
属性,该功能会生效f:convertDateTime
,p:calendar
,timezone
等等。
我还尝试使用Seam
组件TimeZoneSelector
,如下所示。
@In
private TimeZoneSelector timeZoneSelector;
....
timeZoneSelector.setTimeZone(user.getTimeZone());
但是,它不会自动对<f:convertDateTime pattern="hh:mm a"/>
产生影响。
我必须再次检索TimeZone
表格支持bean。
<f:convertDateTime pattern="hh:mm a" timeZone="#{mybean.timeZone}"/>
答案 0 :(得分:1)
JSF没有默认的特殊功能允许你这样做。你需要实现这个功能。
答案 1 :(得分:0)
1-为java.util.Date
1 getAsString
和getAsObject
让转换器从会话中检索用户时区
3-解析/格式化之前使用SimpleDateFormat.setTimezone()