--Umgebung
2020-07-20 09:49:54:387 X-TrackingId:6079d04e-6554-492e-b2be-e01eed06 ERROR MyExceptionHandler.handle:63 Cannot format given Object as a Date
java.lang.IllegalArgumentException: Cannot format given Object as a Date
at java.base/java.text.DateFormat.format(DateFormat.java:338)
at java.base/java.text.Format.format(Format.java:158)
at javax.faces.convert.DateTimeConverter$FormatWrapper.format(DateTimeConverter.java:495)
at javax.faces.convert.DateTimeConverter$FormatWrapper.access$300(DateTimeConverter.java:470)
at javax.faces.convert.DateTimeConverter.getAsString(DateTimeConverter.java:544)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getFormattedValue(HtmlBasicRenderer.java:491)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getFormattedValue(HtmlBasicRenderer.java:509)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:330)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:143)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:595)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1654)
at com.sun.faces.facelets.component.RepeatRenderer.encodeChildren(RepeatRenderer.java:64)
at com.sun.faces.facelets.component.UIRepeat.process(UIRepeat.java:559)
at com.sun.faces.facelets.component.UIRepeat.encodeChildren(UIRepeat.java:1068)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:278)
at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:90)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:566)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1647)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:152)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:566)
<h:outputText value="#{bean.myTimestamp}" >
<f:convertDateTime pattern="yyyy/MM/dd HH:mm" timeZone="Japan" />
</h:outputText>
bean.setMyTimestamp(LocalDateTime.now());
Specifies what contents the string value will be formatted to include, or parsed expecting. Valid values are "date", "time", "both", "localDate", "localDateTime", "localTime", "offsetTime", "offsetDateTime", and "zonedDateTime". convertDateTime (JSF 2.3 View Declaration Language: Facelets Variant, generated with VDLDoc.)
Das wird funktionieren
<h:outputText value="#{bean.myTimestamp}" >
<f:convertDateTime pattern="yyyy/MM/dd HH:mm" timeZone="Japan" type="localDateTime" />
</h:outputText>
Ich mache mir Sorgen um etwas ...
Ich habe es nur eines Tages getan
--Erstellen Sie Ihren eigenen Konverter - java - f:convertDateTime support for Java8 LocalDate / LocalDateTime? - Stack Overflow --Convertieren Sie LocalDateTime in Date und verwenden Sie
Recommended Posts