Beanクラスの無効なプロパティ「フィールド[0]」

矢上ライト:

私は春に働いていると私のエンティティがあります

myEntity.java

@Entity
public class Ecran {
...
@OneToMany(fetch=FetchType.EAGER, cascade = { CascadeType.ALL } , mappedBy="ecran")
public Set<Fields> fields = new HashSet<>();

...
}

そして私はそのようなフィールドのプロパティを変更しようとしています

myPage.html

<div th:each="field, itemStat : *{fields}" >

                <div class="row table-responsive-xl mt-3" >
                    <label class="font-weight-medium h5 black-text"  th:text="${field.nom}" for="${field.idJira}"></label>
                    <input type="text" id="${field.id}" class="form-control mb-6" th:field="*{fields[__${itemStat.index}__].value}">
                </div>

            </div>

しかし、それは私に、このエラーを示しています

2018年8月20日09:09:36.000 ERROR 13144 --- [NIO-8092-EXEC-1] oaccC [[[/] [のDispatcherServlet]。。。のServlet.service()サーブレットの【のDispatcherServlet]に関連して例外が投げたパス[] [要求の処理に失敗しました。ネストされた例外はorg.springframework.beans.InvalidPropertyExceptionです:無効なプロパティ「フィールド[0]」Beanクラスの[com.kepler.skeleton.domain.model.Ecran]:例外を投げたプロパティ「フィールド」を取得するための不正な試み。ネストされた例外がorg.springframework.beans.InvalidPropertyException:無効プロパティ「フィールド[0]」Beanクラスのは、[com.kepler.skeleton.domain.model.Ecran]:サイズ0のセットからのインデックス0を持つ要素を取得できません、使用してアクセス根本的な原因を持つプロパティパス「フィールド[0]」]

org.springframework.beans.InvalidPropertyException:無効なプロパティ「フィールド[0]」Beanクラスの[com.kepler.skeleton.domain.model.Ecranは]:サイズ0のセットからのインデックス0を持つ要素を取得できません、 'プロパティのパスを使用してアクセスorg.springframework.beans.AbstractNestablePropertyAccessorで:org.springframework.beans.AbstractNestablePropertyAccessor.getPropertyValue(AbstractNestablePropertyAccessor.java:664)〜[5.0.8.RELEASE春豆-5.0.8.RELEASE.jar]のフィールド[0]」 .getNestedPropertyAccessor(AbstractNestablePropertyAccessor.java:839)〜[ばね豆-5.0.8.RELEASE.jar:5.0.8.RELEASE] org.springframework.beans.AbstractNestablePropertyAccessor.getPropertyAccessorForPropertyPathで(AbstractNestablePropertyAccessor.java:816)〜[spring-豆-5.0.8.RELEASE.jar:5.0.8.RELEASE] org.springframework.beans.AbstractNestablePropertyAccessorで。org.springframework.beans.AbstractPropertyAccessor.setPropertyValuesで(AbstractPropertyAccessor.java:97)〜[春豆:setPropertyValue(AbstractNestablePropertyAccessor.java:256)〜[5.0.8.RELEASE春豆-5.0.8.RELEASE.jar] -5.0.8.RELEASE.jar:org.springframework.validation.DataBinder.applyPropertyValuesで5.0.8.RELEASE(DataBinder.java:839)〜[ばねコンテキスト5.0.8.RELEASE.jar:5.0.8。 org.springframework.validation.DataBinder.doBindでRELEASE](DataBinder.java:735)〜[ばねコンテキスト5.0.8.RELEASE.jar:5.0.8.RELEASE] org.springframework.web.bind.WebDataBinderました。 doBind(WebDataBinder.java:197)〜[春-ウェブ5.0.8.RELEASE.jar:5.0.8.RELEASE] org.springframework.web.bind.ServletRequestDataBinder.bindで(ServletRequestDataBinder.java:107)〜[春-web-5.0.8.RELEASE.jar:org.springframework.web.servlet.mvc.method.annotationで5.0.8.RELEASE]。ServletModelAttributeMethodProcessor.bindRequestParameters(ServletModelAttributeMethodProcessor.java:157)〜[ばねwebmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE] org.springframework.web.method.annotation.ModelAttributeMethodProcessor.resolveArgumentで(ModelAttributeMethodProcessor.java:152 )〜[ばねウェブ5.0.8.RELEASE.jar:5.0.8.RELEASE] org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:124で)〜[ばねウェブ5.0。 8.RELEASE.jar:org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValuesで5.0.8.RELEASE](InvocableHandlerMethod.java:161)〜[春-ウェブ5.0.8.RELEASE.jar:5.0.8 ORGで5.0.8.RELEASE]:org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequestで.RELEASE](InvocableHandlerMethod.java:131)〜[春-ウェブ5.0.8.RELEASE.jar。org.springframework.web.servletで:springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)〜[5.0.8.RELEASE春-webmvc-5.0.8.RELEASE.jar] org.springframework.web.servlet.mvc.methodで:.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:877)〜[5.0.8.RELEASEばねwebmvc-5.0.8.RELEASE.jar]。 org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handleで(AbstractHandlerMethodAdapter:annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:783)〜[5.0.8.RELEASEばねwebmvc-5.0.8.RELEASE.jar] .java:87)〜[ばねwebmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE] org.springframework.web.servlet.DispatcherServlet.doDispatchで(DispatcherServlet.java:991)〜[ばねwebmvc- 5.0.8.RELEASE。ORGで5.0.8.RELEASE]:ジャー:org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)で5.0.8.RELEASE]〜[スプリングwebmvc-5.0.8.RELEASE.jar。 springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)〜[ばねwebmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE] org.springframework.web.servlet.FrameworkServlet.doPostで(FrameworkServlet .java:877)〜[ばねwebmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE] javax.servlet.http.HttpServlet.serviceで(HttpServlet.java:661)〜[Tomcatの-埋め込みコア - 8.5.32.jar:8.5.32] org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)〜[ばねwebmvc-5.0.8.RELEASE.jarで:で5.0.8.RELEASE] org.apache.catalina.core.ApplicationFilterChainで:javax.servlet.http.HttpServlet.service(HttpServlet.java:742)〜[8.5.32 Tomcatの-埋め込みコア8.5.32.jar]。internalDoFilter(ApplicationFilterChain.java:231)〜[Tomcatの-埋め込みコア8.5.32.jar:8.5.32] org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)で〜[Tomcatの、埋め込み-core-8.5.32.jar:8.5.32] org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)〜[Tomcatの-埋め込みのWebSocket-8.5.32.jarで:8.5。 32] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)〜[Tomcatの-埋め込みコア8.5.32.jarで:org.apache.catalina.core.ApplicationFilterChainで8.5.32]。 doFilter(ApplicationFilterChain.java:166)〜[Tomcatの-埋め込むコア-8.5.32.jar:8.5.32] org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:320)で〜[春-security-ウェブ5.0.7.RELEASE.jar:5.0.7.RELEASE] org.springframework.security.web.access.intercept.FilterSecurityInterceptorで。invoke(FilterSecurityInterceptor.java:127)〜[春 - セキュリティのWeb-5.0.7.RELEASE.jar:5.0.7.RELEASE] org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilterで(FilterSecurityInterceptor.java :91)〜[春 - セキュリティのWeb-5.0.7.RELEASE.jar:5.0.7.RELEASE] org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334時)〜[spring-セキュリティ・ウェブ5.0.7.RELEASE.jar:org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)で5.0.7.RELEASE]〜[春・セキュリティ・ウェブ-5.0.7 .RELEASE.jar:org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)で5.0.7.RELEASE]〜[春 - セキュリティのWeb-5.0.7.RELEASE.jar:5.0。 org.springframework.security.web.session.SessionManagementFilterで7.RELEASE]。org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilterで(FilterChainProxy.java:334:のdoFilter(SessionManagementFilter.java:137)〜[5.0.7.RELEASE春 - セキュリティのWeb-5.0.7.RELEASE.jar] )〜:org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilterで[春・セキュリティ・ウェブ5.0.7.RELEASE.jar 5.0.7.RELEASE](AnonymousAuthenticationFilter.java:111)〜[春、セキュリティにウェブ5.0.7.RELEASE.jar:org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)で5.0.7.RELEASE]〜[春・セキュリティ・ウェブ5.0.7.RELEASE .jar:org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:150)で5.0.7.RELEASE]〜[春 - セキュリティのWeb-5.0.7.RELEASE.jar:5.0。 org.springframework.security.webで7.RELEASE]。FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)〜[春 - セキュリティのWeb-5.0.7.RELEASE.jar:5.0.7.RELEASE] org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilterで(SecurityContextHolderAwareRequestFilter .javaファイル:170)〜[春 - セキュリティのWeb-5.0.7.RELEASE.jar:5.0.7.RELEASE] org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334時)〜[春・セキュリティ・ウェブ5.0.7.RELEASE.jar:org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)で5.0.7.RELEASE]〜[春 - セキュリティのWeb 5.0 .7.RELEASE.jar:org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)で5.0.7.RELEASE]〜[春 - セキュリティのWeb-5.0.7.RELEASE.jar: org.springframework.security.webで5.0.7.RELEASE]。org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilterで(FilterChainProxy:authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)〜[5.0.7.RELEASE春 - セキュリティのWeb-5.0.7.RELEASE.jar] .javaファイル:334)〜[春 - セキュリティのWeb-5.0.7.RELEASE.jar:5.0.7.RELEASE] org.springframework.security.web.authentication.logout.LogoutFilter.doFilterで(LogoutFilter.java:116) 〜[春 - セキュリティのWeb-5.0.7.RELEASE.jar:5.0.7.RELEASE] org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)で〜[春・セキュリティ・ウェブ-5.0.7.RELEASE.jar:org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)で5.0.7.RELEASE]〜[春・セキュリティ・ウェブ5.0.7.RELEASE。瓶:org.springframework.web.filterで5.0.7.RELEASE]。org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilterで(FilterChainProxy.java:334:OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)〜[5.0.8.RELEASE春-ウェブ-5.0.8.RELEASE.jar] )〜:org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilterで[春・セキュリティ・ウェブ5.0.7.RELEASE.jar 5.0.7.RELEASE](SecurityContextPersistenceFilter.java:105)〜[春、セキュリティにウェブ5.0.7.RELEASE.jar:org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:334)で5.0.7.RELEASE]〜[春・セキュリティ・ウェブ5.0.7.RELEASE .jar:org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternalで5.0.7.RELEASE](WebAsyncManagerIntegrationFilter.java:56)〜[春 - セキュリティのWeb-5.0.7.RELEASE.jar: org.springframework.web.filterで5.0.7.RELEASE]。org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilterで(FilterChainProxy.java:334:OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)〜[5.0.8.RELEASE春-ウェブ-5.0.8.RELEASE.jar] )〜:org.springframework.security.web.FilterChainProxy.doFilterInternalで[春・セキュリティ・ウェブ5.0.7.RELEASE.jar 5.0.7.RELEASE](FilterChainProxy.java:215)〜[春-セキュリティWEB- 5.0.7.RELEASE.jar:org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)で5.0.7.RELEASE]〜[春 - セキュリティのWeb-5.0.7.RELEASE.jar:5.0 .7.RELEASE] org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)で〜[春-ウェブ5.0.8.RELEASE.jar:5.0.8.RELEASE] org.springframework.webで.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)〜[春-ウェブ5.0.8.RELEASE.jar:5.0.8。org.apache.catalina.core.ApplicationFilterChainで8.5.32]:org.apache.catalina.core.ApplicationFilterChain.internalDoFilterでRELEASE](ApplicationFilterChain.java:193)〜[Tomcatの-埋め込みコア8.5.32.jar。 doFilter(ApplicationFilterChain.java:166)〜[Tomcatの-埋め込みコア8.5.32.jar:8.5.32] org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)で〜[バネウェブ-5.0.8.RELEASE.jar:org.springframework.web.filter.OncePerRequestFilter.doFilterで5.0.8.RELEASE(OncePerRequestFilter.java:107)〜[ばねウェブ5.0.8.RELEASE.jar:5.0。 org.apache.catalina.coreで8.5.32]:org.apache.catalina.core.ApplicationFilterChain.internalDoFilterで8.RELEASE(ApplicationFilterChain.java:193)〜[Tomcatの-埋め込みコア8.5.32.jar。 ORGで:ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)〜[8.5.32 Tomcatの-埋め込みコア8.5.32.jar]。springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)〜[春-ウェブ5.0.8.RELEASE.jar:5.0.8.RELEASE] org.springframework.web.filter.OncePerRequestFilter.doFilterで(OncePerRequestFilter .javaファイル:107)〜[春-ウェブ5.0.8.RELEASE.jar:5.0.8.RELEASE] org.apache.catalina.core.ApplicationFilterChain.internalDoFilterで(ApplicationFilterChain.java:193)〜[Tomcatの-embed-コア8.5.32.jar:org.apache.catalina.core.ApplicationFilterChain.doFilterで8.5.32](ApplicationFilterChain.java:166)〜[Tomcatの-埋め込みコア8.5.32.jar:8.5.32]でorg.springframework.web.filter.OncePerRequestFilter.doFilterで:org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)〜[5.0.8.RELEASE春-ウェブ-5.0.8.RELEASE.jar] (OncePerRequestFilter.java:107)〜[春-ウェブ5.0.8.RELEASE.jar:5.0.8。org.apache.catalina.core.ApplicationFilterChainで8.5.32]:org.apache.catalina.core.ApplicationFilterChain.internalDoFilterでRELEASE](ApplicationFilterChain.java:193)〜[Tomcatの-埋め込みコア8.5.32.jar。 doFilter(ApplicationFilterChain.java:166)〜[Tomcatの-埋め込みコア8.5.32.jar:8.5.32] org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)で〜[バネウェブ-5.0.8.RELEASE.jar:org.springframework.web.filter.OncePerRequestFilter.doFilterで5.0.8.RELEASE(OncePerRequestFilter.java:107)〜[ばねウェブ5.0.8.RELEASE.jar:5.0。 org.apache.catalina.coreで8.5.32]:org.apache.catalina.core.ApplicationFilterChain.internalDoFilterで8.RELEASE(ApplicationFilterChain.java:193)〜[Tomcatの-埋め込みコア8.5.32.jar。 ORGで:ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)〜[8.5.32 Tomcatの-埋め込みコア8.5.32.jar]。apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)〜[Tomcatの-埋め込みコア8.5.32.jar:8.5.32] org.apache.catalina.core.StandardContextValve.invokeで(StandardContextValve.java :96)[Tomcatの-埋め込みコア8.5.32.jar:8.5.32] org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)における[Tomcatの-埋め込みコア8.5.32。ジャー:8.5.32] org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)における[Tomcatの-埋め込みコア8.5.32.jar:8.5.32] org.apache.catalina.valvesで.ErrorReportValve.invoke(ErrorReportValve.java:81)のTomcat-埋め込みコア8.5.32.jar:8.5.32] org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)でtomcat-コア - 8.5.32.jarを埋め込む:8.5.32] org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)のTomcat-埋め込みコア8.5.32.jarで:8.5.32] ORGで。apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)のTomcat-埋め込みコア8.5.32.jar:8.5.32] org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)で[Tomcatの-埋め込みコア8.5.32.jar:8.5.32] org.apache.coyote.AbstractProtocol $ ConnectionHandler.process(AbstractProtocol.java:800)における[Tomcatの-埋め込みコア8.5.32.jar:8.5 0.32] org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun(NioEndpoint.java:1471)における[Tomcatの-埋め込みコア8.5.32.jar:8.5.32] org.apache.tomcatました。 util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)のTomcat-埋め込みコア8.5.32.jar:8.5.32] java.util.concurrent.ThreadPoolExecutor.runWorkerで(不明ソース)NA:1.8。 :org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.javaで1.8.0_111]:java.util.concurrent.ThreadPoolExecutor $ Worker.run(不明なソース)[NAで0_111]61)[Tomcatの-埋め込みコア8.5.32.jar:8.5.32] java.lang.Thread.run(不明なソースで)NA:1.8.0_111]

Veselin Davidov:

あなたの例外を見て:

...サイズ0のセットからのインデックス0を持つ要素を取得できません、根本的な原因とプロパティパス「フィールド[0]」を使用してアクセス...

あなたは、問題を見ることができます。セットはHashSetのは何のために持っていないためだ何の要素0を持っていません。配列またはリスト - あなたは、インデックス付きのコレクションを必要としています。フロントエンドに設定を渡すと注文した方法でそれを変更するとき、それは実際には非常に共通の問題です。簡単な解決策ではなく、設定のリストを使用することです。

あなたが繰り返しをしたくない場合は、その後、ちょうどあなたのHashSetの周りのArrayListをラップ - フロントエンドに渡した後、重複する要素を取り除くために戻っHashSetのにそれを渡します。

おすすめ

転載: http://43.154.161.224:23101/article/api/json?id=218875&siteId=1