Primefaces 8 - java.lang.UnsupportedOperationException 当验证 primefaces Datepicker mindate 的值时
Primefaces 8 - java.lang.UnsupportedOperationException when validate value of primefaces Datepicker mindate
我是 jsf 和 primefaces 的新手。我有一个带有 springboot、jpa 和 jsf-primefaces 的应用程序,这个应用程序可以在 primefaces 的版本 7 上正常工作,但是我刚刚升级到版本 8,但我遇到了问题。更改日期选择器的值会引发 java.lang.UnsupportedOperationException 异常
java.lang.UnsupportedOperationException:空。调试应用程序我看到异常是在 org.primefaces.util.CalendarUtils class convertDate2LocalTime 方法中生成的,特别是当它试图执行以下转换 date.toInstant ()。 AtZone (zoneId);
我总结一下我认为最相关的,我的datepicker代码如下:
AltaEdicionCandidatos.xhtml
<p:panelGrid columns="4" layout="grid">
<p:outputLabel for="fecha_envio" value="Fecha de envío:" />
<p:datePicker id="fecha_envio" value="#{altaEdicionCandidato.candidato.fechaEnvio}" showIcon="true" locale="es" pattern="dd/MM/yyyy" required="true">
<p:ajax event="dateSelect" listener="#{altaEdicionCandidato.onFechaEnvioChange}" update="fecha_feedback" />
</p:datePicker>
<p:outputLabel for="fecha_feedback" value="Fecha de Feedback de solicitante:" />
<p:datePicker id="fecha_feedback" value="#{altaEdicionCandidato.candidato.fechaFeedbackSolicitante}" showIcon="true" locale="es" mindate="#{altaEdicionCandidato.fecFeedBackMinDate}" pattern="dd/MM/yyyy" required="#{altaEdicionCandidato.reqfechaFeedback}">
<p:ajax event="dateSelect" listener="#{altaEdicionCandidato.onFechaFeedBackChange}" update="fecha_entrevista_ini" />
</p:datePicker>
</p:panelGrid>
AltaEdicionCandidato ManagedBean
@ManagedBean(name="altaEdicionCandidato")
@ViewScoped public class AltaEdicionCandidato implements Serializable {
private Candidato candidato;
private Date fecFeedBackMinDate;
public void onFechaEnvioChange(SelectEvent event)
{
this.fecFeedBackMinDate=((Date)event.getObject());
}
...getters / setters
}
如您所见,组件 fecha_feedback 的值是 fecFeedBackMinDate(of the type java.util.Date)的managedbean altaEdicionCandidato,在选择组件的任何日期时,它会抛出异常java.lang.UnsupportedOperationException异常。
ManagedBean我放它只是作为一个参考,因为它甚至没有运行。
调试进程,我看到它是在 CalendarUtils.convertDate2ZonedDateTime class 的以下行中生成的:
returndate.toInstant()。 atZone (zoneId);
private static ZonedDateTime convertDate2ZonedDateTime (Date date, ZoneId zoneId) {
if (date == null) {
return null;
}
else {
return date.toInstant (). atZone (zoneId);
}
}
我看过,这是因为数据类型java.util.Date只有时分秒,没有时区,所以抛出异常。
此方法的调用从 DatePicker class 开始,它试图获取 java.time.LocalTime 使用 getObjectAsLocalTime 方法键入。
protected ValidationResult validateTimeOnlyValue(FacesContext context, LocalTime time) {
LocalTime minTime = CalendarUtils.getObjectAsLocalTime(context, this, getMindate());
LocalTime maxTime = CalendarUtils.getObjectAsLocalTime(context, this, getMaxdate());
...
因为mindate的值是用getmindate方法获取的,一直没能知道是什么returns
最后,更罕见的是,在另一个视图中,您使用了具有相同组件和数据类型的相同机制,并且没有例外。
AltaPosiciones.xhtml
<p:panel id="p_datos_generales" header="Datos Generales" stleClass="panelGridCenter" >
</p:panel><p:panel id="p_sla" header="SLA" stleClass="panelGridCenter" >
<p:panelGrid >
<p:row>
<p:column>
<p:outputLabel for="fecha_asignacion" value="Fecha de Asignación:" /><br></br>
<p:datePicker id="fecha_asignacion" value="#{altaEdicionPosicionesBean.fechaAsignacion}" readonlyInput="true" showIcon="true" disabled="#{!altaEdicionPosicionesBean.reqInfoSLA}" required="#{altaEdicionPosicionesBean.reqInfoSLA}" label="fecha_asignacion" locale="es" pattern="dd/MM/yyyy" mindate="#{altaEdicionPosicionesBean.fecAsignacionMinDate}">
<p:ajax event="dateSelect" listener="#{altaEdicionPosicionesBean.onFechaAsignacionChange}" update="fec_comp_env_rec" />
</p:datePicker>
</p:column>
</p:row>
</p:panelGrid>
</p:panel>
id 为 fechaAsignacion 的组件具有 managedBean altaEdicionPosicionesBean 的变量 fecAsignacionMinDate 的值,其类型为 java.util.Date
我已经调试过了,它通过了相同的验证和提到的方法,但在这种情况下它不会抛出异常。
这是异常的部分跟踪
context - java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException: null
at java.sql.Date.toInstant(Unknown Source) ~[?:1.8.0_231]
at org.primefaces.util.CalendarUtils.convertDate2ZonedDateTime(CalendarUtils.java:422) ~[primefaces-8.0.jar:8.0]
at org.primefaces.util.CalendarUtils.convertDate2LocalDate(CalendarUtils.java:435) ~[primefaces-8.0.jar:8.0]
at org.primefaces.util.CalendarUtils.convertDate2LocalDate(CalendarUtils.java:427) ~[primefaces-8.0.jar:8.0]
at org.primefaces.util.CalendarUtils.getObjectAsLocalDate(CalendarUtils.java:87) ~[primefaces-8.0.jar:8.0]
at org.primefaces.component.datepicker.DatePicker.validateDateValue(DatePicker.java:215) ~[primefaces-8.0.jar:8.0]
at org.primefaces.component.datepicker.DatePicker.validateDateValue(DatePicker.java:211) ~[primefaces-8.0.jar:8.0]
at org.primefaces.component.datepicker.DatePicker.validateValueInternal(DatePicker.java:163) ~[primefaces-8.0.jar:8.0]
at org.primefaces.component.datepicker.DatePicker.validateValue(DatePicker.java:126) ~[primefaces-8.0.jar:8.0]
at javax.faces.component.UIInput.validate(UIInput.java:988) ~[jsf-api-2.2.20.jar:2.2]
at org.primefaces.component.datepicker.DatePicker.validate(DatePicker.java:103) ~[primefaces-8.0.jar:8.0]
at javax.faces.component.UIInput.executeValidate(UIInput.java:1270) ~[jsf-api-2.2.20.jar:2.2]
at javax.faces.component.UIInput.processValidators(UIInput.java:714) ~[jsf-api-2.2.20.jar:2.2]
at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:575) ~[jsf-impl-2.2.20.jar:2.2.20]
at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183) ~[jsf-impl-2.2.20.jar:2.2.20]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1689) ~[jsf-api-2.2.20.jar:2.2]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700) ~[jsf-api-2.2.20.jar:2.2]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700) ~[jsf-api-2.2.20.jar:2.2]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700) ~[jsf-api-2.2.20.jar:2.2]
at javax.faces.component.UIForm.visitTree(UIForm.java:371) ~[jsf-api-2.2.20.jar:2.2]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700) ~[jsf-api-2.2.20.jar:2.2]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700) ~[jsf-api-2.2.20.jar:2.2]
at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:403) ~[jsf-impl-2.2.20.jar:2.2.20]
at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:266) [jsf-impl-2.2.20.jar:2.2.20]
at org.primefaces.context.PrimePartialViewContext.processPartial(PrimePartialViewContext.java:65) [primefaces-8.0.jar:8.0]
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1193) [jsf-api-2.2.20.jar:2.2]
at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76) [jsf-impl-2.2.20.jar:2.2.20]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.2.20.jar:2.2.20]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) [jsf-impl-2.2.20.jar:2.2.20]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:658) [jsf-api-2.2.20.jar:2.2]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat-websocket.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145) [prettyfaces-jsf2-3.3.3.jar:?]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:226) [rewrite-servlet-3.4.1.Final.jar:3.4.1.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:226) [rewrite-servlet-3.4.1.Final.jar:3.4.1.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:155) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:74) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:130) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.web.servlet.support.ErrorPageFilter.access[=16=]0(ErrorPageFilter.java:66) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilterInternal(ErrorPageFilter.java:105) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:123) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [catalina.jar:9.0.36]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [catalina.jar:9.0.36]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [catalina.jar:9.0.36]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [catalina.jar:9.0.36]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [catalina.jar:9.0.36]
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690) [catalina.jar:9.0.36]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [catalina.jar:9.0.36]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [catalina.jar:9.0.36]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) [tomcat-coyote.jar:9.0.36]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-coyote.jar:9.0.36]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-coyote.jar:9.0.36]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) [tomcat-coyote.jar:9.0.36]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:9.0.36]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_231]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_231]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:9.0.36]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_231]
[WARN ] 2020-07-24 17:17:27.918 [http-nio-8080-exec-3] lifecycle - java.lang.UnsupportedOperationException
javax.faces.FacesException: java.lang.UnsupportedOperationException
拜托,如果你能指导我知道为什么会这样,我将不胜感激。
先谢谢大家了
我希望这会有所帮助,但第一次使用 prime calendar 进行测试。
您的 pattern="dd/MM/yyyy"
没有显示任何关于区域的信息。
尝试这样的模式="yyyy-MM-dd HH:mm:ssZ"
如果你的模型 属性 LocalDate ,模式必须只是日期,如果你的模型 属性 是 LocalDateTime 把模式像 yyyy-MM-dd
我找到了原因,在我的实体模型中,我没有注意到日期列有 @Temporal(TemporalType.DATE) 注释,据我所知映射为 java.sql.Date 而不是 java.util.Date,这就是为什么你第一次加载并直接从加载的对象中引用最小值时,它标记了错误。我删除了这些注释并且它可以正常工作。谢谢大家的评论
我是 jsf 和 primefaces 的新手。我有一个带有 springboot、jpa 和 jsf-primefaces 的应用程序,这个应用程序可以在 primefaces 的版本 7 上正常工作,但是我刚刚升级到版本 8,但我遇到了问题。更改日期选择器的值会引发 java.lang.UnsupportedOperationException 异常 java.lang.UnsupportedOperationException:空。调试应用程序我看到异常是在 org.primefaces.util.CalendarUtils class convertDate2LocalTime 方法中生成的,特别是当它试图执行以下转换 date.toInstant ()。 AtZone (zoneId);
我总结一下我认为最相关的,我的datepicker代码如下:
AltaEdicionCandidatos.xhtml
<p:panelGrid columns="4" layout="grid">
<p:outputLabel for="fecha_envio" value="Fecha de envío:" />
<p:datePicker id="fecha_envio" value="#{altaEdicionCandidato.candidato.fechaEnvio}" showIcon="true" locale="es" pattern="dd/MM/yyyy" required="true">
<p:ajax event="dateSelect" listener="#{altaEdicionCandidato.onFechaEnvioChange}" update="fecha_feedback" />
</p:datePicker>
<p:outputLabel for="fecha_feedback" value="Fecha de Feedback de solicitante:" />
<p:datePicker id="fecha_feedback" value="#{altaEdicionCandidato.candidato.fechaFeedbackSolicitante}" showIcon="true" locale="es" mindate="#{altaEdicionCandidato.fecFeedBackMinDate}" pattern="dd/MM/yyyy" required="#{altaEdicionCandidato.reqfechaFeedback}">
<p:ajax event="dateSelect" listener="#{altaEdicionCandidato.onFechaFeedBackChange}" update="fecha_entrevista_ini" />
</p:datePicker>
</p:panelGrid>
AltaEdicionCandidato ManagedBean
@ManagedBean(name="altaEdicionCandidato")
@ViewScoped public class AltaEdicionCandidato implements Serializable {
private Candidato candidato;
private Date fecFeedBackMinDate;
public void onFechaEnvioChange(SelectEvent event)
{
this.fecFeedBackMinDate=((Date)event.getObject());
}
...getters / setters
}
如您所见,组件 fecha_feedback 的值是 fecFeedBackMinDate(of the type java.util.Date)的managedbean altaEdicionCandidato,在选择组件的任何日期时,它会抛出异常java.lang.UnsupportedOperationException异常。
ManagedBean我放它只是作为一个参考,因为它甚至没有运行。
调试进程,我看到它是在 CalendarUtils.convertDate2ZonedDateTime class 的以下行中生成的: returndate.toInstant()。 atZone (zoneId);
private static ZonedDateTime convertDate2ZonedDateTime (Date date, ZoneId zoneId) {
if (date == null) {
return null;
}
else {
return date.toInstant (). atZone (zoneId);
}
}
我看过,这是因为数据类型java.util.Date只有时分秒,没有时区,所以抛出异常。
此方法的调用从 DatePicker class 开始,它试图获取 java.time.LocalTime 使用 getObjectAsLocalTime 方法键入。
protected ValidationResult validateTimeOnlyValue(FacesContext context, LocalTime time) {
LocalTime minTime = CalendarUtils.getObjectAsLocalTime(context, this, getMindate());
LocalTime maxTime = CalendarUtils.getObjectAsLocalTime(context, this, getMaxdate());
...
因为mindate的值是用getmindate方法获取的,一直没能知道是什么returns
最后,更罕见的是,在另一个视图中,您使用了具有相同组件和数据类型的相同机制,并且没有例外。
AltaPosiciones.xhtml
<p:panel id="p_datos_generales" header="Datos Generales" stleClass="panelGridCenter" >
</p:panel><p:panel id="p_sla" header="SLA" stleClass="panelGridCenter" >
<p:panelGrid >
<p:row>
<p:column>
<p:outputLabel for="fecha_asignacion" value="Fecha de Asignación:" /><br></br>
<p:datePicker id="fecha_asignacion" value="#{altaEdicionPosicionesBean.fechaAsignacion}" readonlyInput="true" showIcon="true" disabled="#{!altaEdicionPosicionesBean.reqInfoSLA}" required="#{altaEdicionPosicionesBean.reqInfoSLA}" label="fecha_asignacion" locale="es" pattern="dd/MM/yyyy" mindate="#{altaEdicionPosicionesBean.fecAsignacionMinDate}">
<p:ajax event="dateSelect" listener="#{altaEdicionPosicionesBean.onFechaAsignacionChange}" update="fec_comp_env_rec" />
</p:datePicker>
</p:column>
</p:row>
</p:panelGrid>
</p:panel>
id 为 fechaAsignacion 的组件具有 managedBean altaEdicionPosicionesBean 的变量 fecAsignacionMinDate 的值,其类型为 java.util.Date
我已经调试过了,它通过了相同的验证和提到的方法,但在这种情况下它不会抛出异常。
这是异常的部分跟踪
context - java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException: null
at java.sql.Date.toInstant(Unknown Source) ~[?:1.8.0_231]
at org.primefaces.util.CalendarUtils.convertDate2ZonedDateTime(CalendarUtils.java:422) ~[primefaces-8.0.jar:8.0]
at org.primefaces.util.CalendarUtils.convertDate2LocalDate(CalendarUtils.java:435) ~[primefaces-8.0.jar:8.0]
at org.primefaces.util.CalendarUtils.convertDate2LocalDate(CalendarUtils.java:427) ~[primefaces-8.0.jar:8.0]
at org.primefaces.util.CalendarUtils.getObjectAsLocalDate(CalendarUtils.java:87) ~[primefaces-8.0.jar:8.0]
at org.primefaces.component.datepicker.DatePicker.validateDateValue(DatePicker.java:215) ~[primefaces-8.0.jar:8.0]
at org.primefaces.component.datepicker.DatePicker.validateDateValue(DatePicker.java:211) ~[primefaces-8.0.jar:8.0]
at org.primefaces.component.datepicker.DatePicker.validateValueInternal(DatePicker.java:163) ~[primefaces-8.0.jar:8.0]
at org.primefaces.component.datepicker.DatePicker.validateValue(DatePicker.java:126) ~[primefaces-8.0.jar:8.0]
at javax.faces.component.UIInput.validate(UIInput.java:988) ~[jsf-api-2.2.20.jar:2.2]
at org.primefaces.component.datepicker.DatePicker.validate(DatePicker.java:103) ~[primefaces-8.0.jar:8.0]
at javax.faces.component.UIInput.executeValidate(UIInput.java:1270) ~[jsf-api-2.2.20.jar:2.2]
at javax.faces.component.UIInput.processValidators(UIInput.java:714) ~[jsf-api-2.2.20.jar:2.2]
at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:575) ~[jsf-impl-2.2.20.jar:2.2.20]
at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183) ~[jsf-impl-2.2.20.jar:2.2.20]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1689) ~[jsf-api-2.2.20.jar:2.2]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700) ~[jsf-api-2.2.20.jar:2.2]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700) ~[jsf-api-2.2.20.jar:2.2]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700) ~[jsf-api-2.2.20.jar:2.2]
at javax.faces.component.UIForm.visitTree(UIForm.java:371) ~[jsf-api-2.2.20.jar:2.2]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700) ~[jsf-api-2.2.20.jar:2.2]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700) ~[jsf-api-2.2.20.jar:2.2]
at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:403) ~[jsf-impl-2.2.20.jar:2.2.20]
at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:266) [jsf-impl-2.2.20.jar:2.2.20]
at org.primefaces.context.PrimePartialViewContext.processPartial(PrimePartialViewContext.java:65) [primefaces-8.0.jar:8.0]
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1193) [jsf-api-2.2.20.jar:2.2]
at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76) [jsf-impl-2.2.20.jar:2.2.20]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.2.20.jar:2.2.20]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) [jsf-impl-2.2.20.jar:2.2.20]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:658) [jsf-api-2.2.20.jar:2.2]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat-websocket.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145) [prettyfaces-jsf2-3.3.3.jar:?]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:226) [rewrite-servlet-3.4.1.Final.jar:3.4.1.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:226) [rewrite-servlet-3.4.1.Final.jar:3.4.1.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:155) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:74) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) [spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:130) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.web.servlet.support.ErrorPageFilter.access[=16=]0(ErrorPageFilter.java:66) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilterInternal(ErrorPageFilter.java:105) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:123) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [catalina.jar:9.0.36]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [catalina.jar:9.0.36]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [catalina.jar:9.0.36]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [catalina.jar:9.0.36]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [catalina.jar:9.0.36]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [catalina.jar:9.0.36]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [catalina.jar:9.0.36]
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690) [catalina.jar:9.0.36]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [catalina.jar:9.0.36]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [catalina.jar:9.0.36]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) [tomcat-coyote.jar:9.0.36]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-coyote.jar:9.0.36]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-coyote.jar:9.0.36]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) [tomcat-coyote.jar:9.0.36]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:9.0.36]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_231]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_231]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:9.0.36]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_231]
[WARN ] 2020-07-24 17:17:27.918 [http-nio-8080-exec-3] lifecycle - java.lang.UnsupportedOperationException
javax.faces.FacesException: java.lang.UnsupportedOperationException
拜托,如果你能指导我知道为什么会这样,我将不胜感激。
先谢谢大家了
我希望这会有所帮助,但第一次使用 prime calendar 进行测试。
您的 pattern="dd/MM/yyyy"
没有显示任何关于区域的信息。
尝试这样的模式="yyyy-MM-dd HH:mm:ssZ"
如果你的模型 属性 LocalDate ,模式必须只是日期,如果你的模型 属性 是 LocalDateTime 把模式像 yyyy-MM-dd
我找到了原因,在我的实体模型中,我没有注意到日期列有 @Temporal(TemporalType.DATE) 注释,据我所知映射为 java.sql.Date 而不是 java.util.Date,这就是为什么你第一次加载并直接从加载的对象中引用最小值时,它标记了错误。我删除了这些注释并且它可以正常工作。谢谢大家的评论