ActiveIndex из TabView не обновляется

У меня следующая проблема.

Существует TabView с 3 вкладками. В каждой вкладке у меня есть две таблицы данных. Если я выберу строку в первой таблице, связанные данные будут загружены во вторую таблицу. Например (псевдокод):

<form>
<tabview>
    <tab>
        <datatable>
           (data in table A)
        <datatable/>
        <datatable>
           (data that is dynamically loaded if one row in table A is selected)
        <datatable/>
   <tab/>
        <datatable>
           ........
        <datatable/>
        <datatable>
           ........
        <datatable/>
  <tab/>
  <tab>
        <datatable>
           ........
        <datatable/>
        <datatable>
           ........
        <datatable/>
  <tab/>
 <tabview/>
<form/>

Если я выбираю элемент в первой таблице (таблица A), соответствующие данные загружаются во вторую таблицу (как в примере выше). Но прежде чем я смогу переключиться на другую таблицу, я должен явно отменить выбор выбранной строки в первой таблице, чтобы activeIndex обновлялся и происходило событие отмены выбора в компоненте поддержки, которое очищает связанные данные во второй таблице. Если я не делаю этого отмены, мой activeIndex из вкладки не обновляется, и я получаю это сообщение об ошибке.

**

INFO: javax.el.PropertyNotFoundException: /auslegerStativEdit.xhtml @160,66 value="#{dataRowDuesKombi.auslegertyp}": Target Unreachable, identifier 'dataRowDuesKombi' resolved to null
javax.el.PropertyNotFoundException: /auslegerStativEdit.xhtml @160,66 value="#{dataRowDuesKombi.auslegertyp}": Target Unreachable, identifier 'dataRowDuesKombi' resolved to null
    at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:100)
    at org.primefaces.renderkit.InputRenderer.getConverter(InputRenderer.java:162)
    at org.primefaces.renderkit.InputRenderer.getConvertedValue(InputRenderer.java:175)
    at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1030)
    at javax.faces.component.UIInput.validate(UIInput.java:960)
    at javax.faces.component.UIInput.executeValidate(UIInput.java:1233)
    at javax.faces.component.UIInput.processValidators(UIInput.java:698)
    at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
    at javax.faces.component.UIData.iterate(UIData.java:1999)
    at javax.faces.component.UIData.processValidators(UIData.java:1204)
    at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
    at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
    at org.primefaces.component.tabview.TabView.processValidators(TabView.java:322)
    at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:508)
    at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183)
    at org.primefaces.component.tabview.TabView.visitTree(TabView.java:391)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
    at javax.faces.component.UIForm.visitTree(UIForm.java:362)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
    at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:376)
    at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:252)
    at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:183)
    at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1170)
    at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at at.beko.rainstar2.ui.filter.CustomCharacterEncodingFilter.doFilter(CustomCharacterEncodingFilter.java:25)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter.doFilter(AbstractPreAuthenticatedProcessingFilter.java:88)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
11.05.2012 08:29:38 com.sun.faces.context.flash.ELFlash setCookie
WARNUNG: JSF1095: The response was already committed by the time we tried to set the outgoing cookie for the flash.  Any values stored to the flash will not be available on the next request.

**

Вот пример кода

XHTML

        <h:form id="form" prependId="false">
        <p:tabView id="tabView"
            activeIndex="#{auslegerStativEditBean.activeTabIndex}">
            <p:ajax event="tabChange"
                listener="#{auslegerStativEditBean.onTabChange}" immediate="true" />

            <p:tab title="#{msg.menu_auslegerstativ_duesen}" id="one">
                <p:outputPanel>
                    <p:dataTable var="dataRowDues"
                        selection="#{auslegerStativEditBean.auslduesSelection}"
                        first="#{auslegerStativEditBean.firstRowIndexDues}"
                        value="#{auslegerStativEditBean.auslduesList}" editable="true"
                        id="dues" paginator="true"
                        rows="#{auslegerStativEditBean.rowsPerPageDues}"
                        paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                        rowsPerPageTemplate="15,25,35"
                        rowKey="#{dataRowDues.auslegertyp}" selectionMode="single"
                        widgetVar="dues">
                        <p:column
                            headerText="#{msg.table_auslegerstativ_dues_auslegertyp}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{dataRowDues.auslegertyp}" />
                                </f:facet>
                                <f:facet name="input">
                                    <p:inputText required="true"
                                        value="#{dataRowDues.auslegertyp}" />
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column
                            headerText="#{msg.table_auslegerstativ_dues_auslegerbreite}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{dataRowDues.auslegerbreite}" />
                                </f:facet>
                                <f:facet name="input">
                                    <p:inputText required="true"
                                        value="#{dataRowDues.auslegerbreite}" />
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column
                            headerText="#{msg.table_auslegerstativ_dues_streifenbreite}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{dataRowDues.streifenbreite}" />
                                </f:facet>
                                <f:facet name="input">
                                    <p:inputText required="true"
                                        value="#{dataRowDues.streifenbreite}" />
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column
                            headerText="#{msg.table_auslegerstativ_dues_auslegergewicht}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{dataRowDues.auslegergewicht}" />
                                </f:facet>
                                <f:facet name="input">
                                    <p:inputText required="true"
                                        value="#{dataRowDues.auslegergewicht}" />
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column headerText="#{msg.table_auslegerstativ_dues_mindruck}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{dataRowDues.mindruck}" />
                                </f:facet>
                                <f:facet name="input">
                                    <p:inputText required="true" value="#{dataRowDues.mindruck}" />
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column
                            headerText="#{msg.table_auslegerstativ_dues_niederschlagsindex}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{dataRowDues.niederschlagsindex}" />
                                </f:facet>
                                <f:facet name="input">
                                    <p:inputText required="true"
                                        value="#{dataRowDues.niederschlagsindex}" />
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column headerText="#{msg.table_auslegerstativ_dues_druck1}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{dataRowDues.druck1}" />
                                </f:facet>
                                <f:facet name="input">
                                    <p:inputText required="true" value="#{dataRowDues.druck1}" />
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column headerText="#{msg.table_auslegerstativ_dues_druck2}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{dataRowDues.druck2}" />
                                </f:facet>
                                <f:facet name="input">
                                    <p:inputText required="true" value="#{dataRowDues.druck2}" />
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column headerText="#{msg.table_auslegerstativ_dues_druck3}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{dataRowDues.druck3}" />
                                </f:facet>
                                <f:facet name="input">
                                    <p:inputText required="true" value="#{dataRowDues.druck3}" />
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column headerText="#{msg.column_head_edit}">
                            <p:rowEditor />
                            <p:commandButton icon="ui-icon-close"
                                styleClass="rainstar-button-small-edit"
                                action="#{auslegerStativEditBean.btn_deleteEntryClick0()}"
                                update=":form">
                                <f:setPropertyActionListener
                                    target="#{auslegerStativEditBean.selectedAusldues}"
                                    value="#{dataRowDues}" />
                            </p:commandButton>
                        </p:column>
                        <p:ajax event="rowEdit"
                            listener="#{auslegerStativEditBean.btn_editEntryClick0}"
                            update=":form" />
                        <p:ajax event="rowSelect"
                            listener="#{auslegerStativEditBean.selectionChangeAusldues}"
                            update=":form" />
                        <p:ajax event="rowUnselect"
                            listener="#{auslegerStativEditBean.deselectionChangeAusldues()}"
                            update=":form" />
                    </p:dataTable>

                    <p:dataTable var="dataRowDuesKombi"
                        binding="#{auslegerStativEditBean.auslduesKombiTable}"
                        value="#{auslegerStativEditBean.auslduesKombiList}"
                        editable="true" id="duesK" paginator="true" rows="15"
                        paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                        rowsPerPageTemplate="15,25,35">
                        <p:column
                            headerText="#{msg.table_auslegerstativ_dues_kombi_auslegertyp}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{dataRowDuesKombi.auslegertyp}" />
                                </f:facet>
                                <f:facet name="input">
                                    <p:inputText required="true"
                                        value="#{dataRowDuesKombi.auslegertyp}" />
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column
                            headerText="#{msg.table_auslegerstativ_dues_kombi_duesenkomb}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{dataRowDuesKombi.duesenkomb}" />
                                </f:facet>
                                <f:facet name="input">
                                    <p:inputText required="true"
                                        value="#{dataRowDuesKombi.duesenkomb}" />
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column
                            headerText="#{msg.table_auslegerstativ_dues_kombi_vollkreis_Anz}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{dataRowDuesKombi.vollkreis_Anz}" />
                                </f:facet>
                                <f:facet name="input">
                                    <p:inputText required="true"
                                        value="#{dataRowDuesKombi.vollkreis_Anz}" />
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column
                            headerText="#{msg.table_auslegerstativ_dues_kombi_vollkreis_Groesse}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{dataRowDuesKombi.vollkreis_Groesse}" />
                                </f:facet>
                                <f:facet name="input">
                                    <p:inputText required="true"
                                        value="#{dataRowDuesKombi.vollkreis_Groesse}" />
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column
                            headerText="#{msg.table_auslegerstativ_dues_kombi_halbkreis_Anz}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{dataRowDuesKombi.halbkreis_Anz}" />
                                </f:facet>
                                <f:facet name="input">
                                    <p:inputText required="true"
                                        value="#{dataRowDuesKombi.halbkreis_Anz}" />
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column
                            headerText="#{msg.table_auslegerstativ_dues_kombi_halbkreis_Groesse}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{dataRowDuesKombi.halbkreis_Groesse}" />
                                </f:facet>
                                <f:facet name="input">
                                    <p:inputText required="true"
                                        value="#{dataRowDuesKombi.halbkreis_Groesse}" />
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column
                            headerText="#{msg.table_auslegerstativ_dues_kombi_ges_Alpha}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{dataRowDuesKombi.ges_Alpha}" />
                                </f:facet>
                                <f:facet name="input">
                                    <p:inputText required="true"
                                        value="#{dataRowDuesKombi.ges_Alpha}" />
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column
                            headerText="#{msg.table_auslegerstativ_dues_kombi_equival_dm}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{dataRowDuesKombi.equival_dm}" />
                                </f:facet>
                                <f:facet name="input">
                                    <p:inputText required="true"
                                        value="#{dataRowDuesKombi.equival_dm}" />
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column
                            headerText="#{msg.table_auslegerstativ_dues_kombi_intensitaets_Index}">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{dataRowDuesKombi.intensitaets_Index}" />
                                </f:facet>
                                <f:facet name="input">
                                    <p:inputText required="true"
                                        value="#{dataRowDuesKombi.intensitaets_Index}" />
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
                        <p:column headerText="#{msg.column_head_edit}">
                            <p:rowEditor />
                            <p:commandButton icon="ui-icon-close"
                                styleClass="rainstar-button-small-edit"
                                action="#{auslegerStativEditBean.btn_deleteEntryClick1()}"
                                update=":form">
                                <f:setPropertyActionListener
                                    target="#{auslegerStativEditBean.selectedAuslduesKombi}"
                                    value="#{dataRowDuesKombi}" />
                            </p:commandButton>
                        </p:column>
                        <p:ajax event="rowEdit"
                            listener="#{auslegerStativEditBean.btn_editEntryClick1}"
                            update=":form" />
                    </p:dataTable>
                </p:outputPanel>
            </p:tab>

            .
            // THE SAME FOR THE NEXT TWO TABS
            .
            .
            .
        </p:tabView>

        <div class="button-footer">
            <p:commandButton value="#{msg.button_new_entry}" icon="ui-icon-plus"
                styleClass="button-header"
                action="#{auslegerStativEditBean.btn_addNewEntryClick()}"
                update=":form" />
        </div>
    </h:form>

боб

@Named("auslegerStativEditBean")

@SessionScoped public class AuslegerStativEditController {

@Inject
private AuslduesService auslduesService;

@Getter
@Setter
private List<Ausldues> auslduesList;
@Getter
@Setter
private List<AuslduesKombi> auslduesKombiList;

@Getter
@Setter
private Ausldues selectedAusldues;
@Getter
@Setter
private AuslduesKombi selectedAuslduesKombi;

public AuslegerStativEditController() {
    selectedAusldues = new Ausldues();
    selectedAuslduesKombi = new AuslduesKombi();
}

public final void onTabChange(final TabChangeEvent event) {
    TabView tv = (TabView) event.getComponent();
    activeTabIndex = tv.getActiveIndex();
}

@PostConstruct
public void init() {
    auslduesList = auslduesService.findAll();
    ausleg2List = ausleg2Service.findAll();
    auslregnList = auslregnService.findAll();
    duesend2List = duesend2Service.findAll();
}

public void selectionChange(SelectEvent event) {
    switch (activeTabIndex) {
    case 0: {
        Ausldues a = (Ausldues) event.getObject();
        auslduesKombiList = auslduesKombiService.findByAusldues(a);
        break;
    }
    case 1: {
        Ausleg2 a = (Ausleg2) event.getObject();
        ausleg2KombiList = ausleg2KombiService.findByAusleg2(a);
        break;
    }
    case 2: {
        Auslregn a = (Auslregn) event.getObject();
        auslregnKombiList = auslregnKombiService.findByAuslregn(a);
        break;
    }
    }
}

public void deselectionChange(UnselectEvent event) {
    switch (activeTabIndex) {
    case 0: {
        auslduesKombiList = null;
        break;
    }
    case 1: {
        ausleg2KombiList = null;
        break;
    }
    case 2: {
        auslregnKombiList = null;
        break;
    }
    }
}

}

Конечно, я пропустил некоторые части кода, которые не имеют отношения к делу.

0 ответов

Другие вопросы по тегам