Dynamically generated panelGroup can't be located - jsf

I have the following structure in my application:
<h:outputLabel value="Regiões :" />
<p:autoComplete multiple="true" value="#{investimento.regioesSelecionadas}"
completeMethod="#{investimento.completaRegiao}"
var="reg" itemLabel="#{reg.label}" itemValue="#{reg}"
converter="entityConverter" forceSelection="true">
<p:column>
<h:outputText value="#{reg.label}" />
</p:column>
<p:ajax event="itemSelect" update="regiaoCol" />
<p:ajax event="itemUnselect" update="regiaoCol" />
<p:ajax event="itemUnselect" listener="#{investimento.tiraUmaRegiao}"/>
</p:autoComplete>
<h:outputText />
<h:panelGroup id="regiaoCol">
<c:forEach items="#{investimento.regioesSelecionadas}" var="regSel" rendered="#{!investimento.regioesSelecionadas.isEmpty()}">
<h:panelGrid columns="2">
<h:outputLabel value="Região #{regSel.label} - Estados:" />
<p:autoComplete multiple="true" value="#{investimento.estadosSelecionados}"
var="est" itemLabel="#{est.label}" itemValue="#{est}"
completeMethod="#{investimento.completaEstado}"
converter="entityConverter" forceSelection="true" cash="true">
<f:attribute name="regPar" value="#{regSel}" />
<p:column>
<h:outputText value="#{est.label}" />
</p:column>
<p:ajax event="itemSelect" update="#{investimento.idComposta(est, regSel)}" />
<p:ajax event="itemUnselect" update="regiaoCol" />
<p:ajax event="itemUnselect" update="#{investimento.idComposta(est, regSel)}"/>
<p:ajax event="itemUnselect" update="#{investimento.idComposta(est, regSel)}" listener="#{investimento.tiraUmEstado}"/>
</p:autoComplete>
<h:outputLabel />
<h:panelGroup id="#{investimento.idComposta(est, regSel)}">
<c:forEach items="#{investimento.estadosSelecionados}" var="estSel">
<h:panelGrid columns="2">
<h:outputLabel value="Estado #{estSel.label} - Municipios: #{investimento.idComposta(est, regSel)}" />
<p:autoComplete multiple="true" value="#{investimento.municipiosSelecionados}"
var="mun" itemLabel="#{mun.label}" itemValue="#{mun}"
completeMethod="#{investimento.completaMunicipio}" maxResults="8"
converter="entityConverter" forceSelection="true" cash="true">
<f:attribute name="estPar" value="#{estSel}" />
<p:column>
<h:outputText value="#{mun.label}" />
</p:column>
</p:autoComplete>
</h:panelGrid>
</c:forEach>
</h:panelGroup>
</h:panelGrid>
</c:forEach>
</h:panelGroup>
So, whenever I pick a "Região" will apear in "regiaoCol" new options for the user to select. However there's an issue: when I remove a "Região", add it again and try to remove it once more, it causes the following error:
> Grave: Error Rendering View[/InsI.xhtml]
javax.faces.FacesException: Cannot find component with expression "munEst2Reg3" referenced from "form:j_idt190".
at org.primefaces.expression.SearchExpressionFacade.resolveComponentInternal(SearchExpressionFacade.java:422)
at org.primefaces.expression.SearchExpressionFacade.resolveComponentForClient(SearchExpressionFacade.java:200)
at org.primefaces.expression.SearchExpressionFacade.resolveComponentsForClient(SearchExpressionFacade.java:147)
at org.primefaces.util.AjaxRequestBuilder.addExpressions(AjaxRequestBuilder.java:92)
at org.primefaces.util.AjaxRequestBuilder.update(AjaxRequestBuilder.java:85)
at org.primefaces.behavior.ajax.AjaxBehaviorRenderer.getScript(AjaxBehaviorRenderer.java:80)
at javax.faces.component.behavior.ClientBehaviorBase.getScript(ClientBehaviorBase.java:103)
at org.primefaces.renderkit.CoreRenderer.encodeClientBehaviors(CoreRenderer.java:458)
Which, I presume, is caused by the browser looking for that reference, in this case "munEst2Reg3" and it not being there. However: why it throws the error? How is it different from removing the "Região" the first time? How to I solve the issue? Should I submit the page after each unselection? (which wouldn't be the most user friendly option)

Tiny's response put me on the right track and, after some debuging I found somethings:
As all the instances are altering the same list is paramount that all of them have a event or one will delete the inputs of the other;
You have also to take care on how the dataTable behaves and guarantee that he only gets the values that you are interested in;
How my code ended up being:
<h:outputLabel value="Regiões :" />
<p:autoComplete multiple="true" value="#{investimento.regioesSelecionadas}"
completeMethod="#{investimento.completaRegiao}"
var="reg" itemLabel="#{reg.label}" itemValue="#{reg}"
converter="entityConverter" forceSelection="true">
<p:column>
<h:outputText value="#{reg.label}" />
</p:column>
<p:ajax event="itemSelect" update="regiaoCol" />
<p:ajax event="itemUnselect" update="regiaoCol" listener="#{investimento.tiraUmaRegiao}"/>
</p:autoComplete>
<h:outputText />
<h:panelGroup id="regiaoCol">
<p:dataTable value="#{investimento.regioesSelecionadas}" var="regSel" rendered="#{investimento.regioesSelecionadas.isEmpty() == false}">
<p:column>
<h:outputLabel value="Região #{regSel.label} - Estados:" />
</p:column>
<p:column>
<p:autoComplete multiple="true" value="#{investimento.estadosSelecionados}"
var="est" itemLabel="#{est.label}" itemValue="#{est}"
completeMethod="#{investimento.completaEstado}"
converter="entityConverter" forceSelection="true">
<f:attribute name="regPar" value="#{regSel}" />
<p:column>
<h:outputText value="#{est.label}" />
</p:column>
<p:ajax event="itemSelect" update="#{investimento.idComposta()}" >
<f:attribute name="regiaoPar" value="#{regSel}" />
</p:ajax>
<p:ajax event="itemUnselect" update="#{investimento.idComposta()}" listener="#{investimento.tiraUmEstado}">
<f:attribute name="regiaoPar" value="#{regSel}" />
</p:ajax>
</p:autoComplete>
</p:column>
<p:column>
<h:panelGroup id="#{investimento.idComposta()}">
<f:attribute name="regiaoPar" value="#{regSel}" />
<p:dataTable value="#{investimento.meusEstSel()}" var="estSel" rendered="#{investimento.meusEstSel().isEmpty() == false}">
<f:attribute name="regiaoPar" value="#{regSel}" />
<p:column>
<h:outputLabel value="Estado #{estSel.label} - Municipios:" />
</p:column>
<p:column>
<p:autoComplete multiple="true" value="#{investimento.municipiosSelecionados}"
var="mun" itemLabel="#{mun.label}" itemValue="#{mun}"
completeMethod="#{investimento.completaMunicipio}" maxResults="8"
converter="entityConverter" forceSelection="true">
<f:attribute name="estPar" value="#{estSel}" />
<p:column>
<h:outputText value="#{mun.label}" />
</p:column>
<p:ajax event="itemSelect" />
<p:ajax event="itemUnselect" />
</p:autoComplete>
</p:column>
</p:dataTable>
</h:panelGroup>
</p:column>
</p:dataTable>
</h:panelGroup>

Related

Exporter doesn't work

I'm using an old version of PF (3.5) but I can't get DataExporter to work with the attribute selectionOnly="true".
If I don't set that attribute, everything works fine, vice versa I get this error:
Caused by: javax.el.ELException: /WEB-INF/views/AreaRiservata/Clinipass/Malattia/malattiaScaricoMandatiTesoreria.xhtml #91,61 value="#{mandato.codCompagnia}": Cannot convert codCompagnia of type class java.lang.String to class java.lang.Integer
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114) ~[jsf-impl-2.1.13.jar:2.1.13]
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:186) ~[jboss-jsf-api_2.1_spec-2.0.9.Final.jar:2.0.9.Final]
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:174) ~[jboss-jsf-api_2.1_spec-2.0.9.Final.jar:2.0.9.Final]
at javax.faces.component.UIOutput.getValue(UIOutput.java:169) ~[jboss-jsf-api_2.1_spec-2.0.9.Final.jar:2.0.9.Final]
My datatable looks like this:
<p:ajax event="rowSelectCheckbox" update=":formTable:buttons" />
<p:ajax event="rowUnselectCheckbox" update=":formTable:buttons" />
<p:ajax event="toggleSelect" update=":formTable:buttons" />
<p:ajax event="rowSelect" update=":formTable:buttons" />
<p:ajax event="rowUnselect" update=":formTable:buttons" />
<p:column selectionMode="multiple" style="width:16px;text-align:center"/>
<p:column filterMaxLength="4" filterBy="#{mandato.codCompagnia}" sortBy="#{mandato.codCompagnia}" width="75" id="amala">
<f:facet name="header">
<h:outputText value="Compagnia" />
</f:facet>
<h:outputText value="#{mandato.codCompagnia}" />
</p:column>
<p:column filterBy="#{mandato.codProdotto}" sortBy="#{mandato.codProdotto}" width="75">
<f:facet name="header">
<h:outputText value="Prodotto" />
</f:facet>
<h:outputText value="#{mandato.codProdotto}" />
</p:column>
<p:column filterBy="#{mandato.annoSinistro}" sortBy="#{mandato.annoSinistro}" width="85">
<f:facet name="header">
<h:outputText value="Anno Sinistro" />
</f:facet>
<h:outputText value="#{mandato.annoSinistro}" />
</p:column>
<p:commandButton value="Crea file" ajax="false" icon="ui-icon-document">
<p:dataExporter type="csv" target="tableScaricoMandatiTesoreria" fileName="Mandati" selectionOnly="true" />
</p:commandButton>
you missed postProcessor attribute in dataExporter Component
<p:dataExporter type="csv" target="tableScaricoMandatiTesoreria"
postProcessor="#{ExportCbean.postProcessXLS}" fileName="Mandati" selectionOnly="true" />
It's not an actual fix but i've managed to bypass the issue by creating another datatable with
id="tableScaricoMandatiTesoreriaSelected" style="display: none" value="#{malattiaScaricoMandatiTesoreriaModel.selectedMandati}"
Then I've changed the ajax's updates in the other table:
<p:ajax event="rowSelectCheckbox" update=":formTable:buttons :formTable:tableScaricoMandatiTesoreriaSelected" />
<p:ajax event="rowUnselectCheckbox" update=":formTable:buttons :formTable:tableScaricoMandatiTesoreriaSelected" />
<p:ajax event="toggleSelect" update=":formTable:buttons :formTable:tableScaricoMandatiTesoreriaSelected" />
<p:ajax event="rowSelect" update=":formTable:buttons :formTable:tableScaricoMandatiTesoreriaSelected" />
<p:ajax event="rowUnselect" update=":formTable:buttons :formTable:tableScaricoMandatiTesoreriaSelected" />
And the exporter now points to the new table:
<p:dataExporter type="xls" target="tableScaricoMandatiTesoreriaSelected" fileName="Mandati" />

h:commandLink can't update Primefaces DataTable

I have the following xhtml:
<f:metadata>
<f:viewParam name="livroId" value="#{livroBean.livro.id}" />
<f:viewAction action="#{livroBean.carregarLivroPelaId}"
if="#{param.livroId != null}" />
</f:metadata>
<ui:define name="titulo">
<p:outputPanel>Novo Livro</p:outputPanel>
</ui:define>
<ui:define name="conteudo">
<h:form>
<p:messages id="messages" />
<p:fieldset legend="Dados do Livro">
<p:panelGrid columns="2">
<p:outputLabel value="Titulo:" for="titulo" />
<p:inputText id="titulo" value="#{livroBean.livro.titulo}"
required="true" requiredMessage="Título obrigatório"
validatorMessage="Título não pode ser superior a 40">
<f:validateLength maximum="40" />
<f:ajax event="blur" render="messages" />
</p:inputText>
<p:outputLabel value="ISBN:" for="isbn" />
<p:inputMask id="isbn" value="#{livroBean.livro.isbn}"
validator="#{livroBean.comecaComDigitoUm}"
mask="999-9-99-999999-9" />
<p:outputLabel value="Preço:" for="preco" />
<p:inputText id="preco" value="#{livroBean.livro.preco}" />
<p:outputLabel value="Data de Lançamento:" for="dataLancamento" />
<p:calendar id="dataLancamento"
value="#{livroBean.livro.dataLancamento.time}"
pattern="dd/MM/yyyy" timeZone="America/Sao_Paulo" mask="true" />
</p:panelGrid>
</p:fieldset>
<br />
<p:fieldset legend="Dados do Autor">
<p:panelGrid columns="4">
<p:outputLabel value="Selecione Autor:" for="autor" />
<p:selectOneMenu value="#{livroBean.autorId}" id="autor">
<f:selectItems value="#{livroBean.autores}" var="autor"
itemLabel="#{autor.nome}" itemValue="#{autor.id}" />
</p:selectOneMenu>
<p:commandButton value="Gravar Autor"
action="#{livroBean.gravarAutor}" process="#this autor"
update="tabelaAutores" />
<p:commandLink value="ou cadastrar novo autor"
action="#{livroBean.formAutor}" immediate="true" update="#all" />
</p:panelGrid>
<p:dataTable value="#{livroBean.autoresDoLivro}" var="autor"
id="tabelaAutores" emptyMessage="Nenhum autor">
<p:column>
<h:outputText value="#{autor.nome}" />
</p:column>
<p:column>
<p:commandLink value="X"
action="#{livroBean.removerAutorDoLivro(autor)}"
update="tabelaAutores" process="#this" />
</p:column>
</p:dataTable>
</p:fieldset>
<br />
<h:panelGrid style="margin: 0 auto">
<p:commandButton value="Gravar" action="#{livroBean.gravar}"
process="#form" update="#form :formTabelaLivros:tabelaLivros" />
</h:panelGrid>
</h:form>
<br />
<h:form id="formTabelaLivros">
<p:dataTable value="#{livroBean.livros}" var="livro"
id="tabelaLivros" paginator="true" rows="5">
<f:facet name="header">Livros</f:facet>
<p:column headerText="Título" sortBy="#{livro.titulo}"
filterBy="#{livro.titulo}" filterMatchMode="startsWith">
<h:outputText value="#{livro.titulo}" />
</p:column>
<p:column headerText="ISBN" sortBy="#{livro.isbn}">
<h:outputText value="#{livro.isbn}" />
</p:column>
<p:column headerText="Preço" sortBy="#{livro.preco}">
<h:outputText value="#{livro.preco}">
<f:convertNumber type="currency" pattern="R$ #0.00"
currencySymbol="R$" locale="pt_BR" />
</h:outputText>
</p:column>
<p:column headerText="Data" sortBy="#{livro.dataLancamento.time}">
<h:outputText value="#{livro.dataLancamento.time}">
<f:convertDateTime pattern="dd/MM/yyyy"
timeZone="America/Sao_Paulo" />
</h:outputText>
</p:column>
<p:column headerText="Alterar">
<h:commandLink value="Alterar" action="#{livroBean.carregar(livro)}" />
</p:column>
<p:column headerText="Remover">
<h:commandLink value="Remover" action="#{livroBean.remover(livro)}" />
</p:column>
</p:dataTable>
</h:form>
</ui:define>
The h:commandLink "Remover" is actually removing the object from my database, but is not updating the DataTable. I've already set process="#form" update="#form", but it doesn't help.
It was actually working fine before, and it suddenly stopped (I didn't modify anything related to my bean).
EDIT:
I changed it to a CommandButton, as below:
<p:column headerText="Remover">
<p:commandButton icon="fa fa-fw fa-remove" actionListener="#{livroBean.remover(livro)}" process="#form" update="#form" />
</p:column>
But still no results... The button works, it removes the entry from my database, but it does not updates the datatable. Tried with action= as well.

DataTable isnt editable after i switch the tabs

I'm nesting a datable in tabview. On the first page its all working correctly and i can edit the table, but after i switch the tabs, the datatable isnt editable anymore.
Is there something i'm doing wrong?
Using Primefaces 5.3
<h:form id="form">
<p:tabView id="tabs" value="#{studentsTableView.exams}" activeIndex="#{studentsTableView.activTab}" dynamic="true" var="exam" binding="#{tabView}" cache="false" >
<p:ajax event="tabChange" update="form:tabs" />
<p:tab id="tab" title="#{exam.name}">
<p:dataTable id="students" rowIndexVar="rowIndex" var="student" editable="true" widgetVar="gradetable" editMode="cell" tableStyle="width:auto" styleClass="myTable" value="#{studentsTableView.students}">
<p:ajax event="cellEdit" update="students" />
<p:column headerText="Nr">
<h:outputText value="#{rowIndex+1}" />
</p:column>
<p:column headerText="Vorname">
<h:outputText value="#{student.vorname}" />
</p:column>
<p:column headerText="Nachname">
<h:outputText value="#{student.nachname}" />
</p:column>
<p:column headerText="Matrikelnummer">
<h:outputText value="#{student.matrikelnummer}" />
</p:column>
<p:columns value="#{exam.allExams}" var="subexam" columnIndexVar="colIndex">
<f:facet name="header">
<h:outputText value="#{subexam.examName}" />
</f:facet>
<p:cellEditor>
<f:facet name="output"><h:outputText id="modeloutput" value="#{studentsTableView.getGrade(subexam, student)}" /></f:facet>
<f:facet name="input"><p:inputText id="modelInput" value="#{studentsTableView.currentGrade}" valueChangeListener="#{studentsTableView.insertGrade(subexam, student)}" style="width:90%">
<p:ajax event="change" update="modelInput" />
<p:ajax event="change" update="modeloutput" />
<p:ajax event="change" update="modeloutput" />
<p:ajax event="change" update=":form:tabs:0:students" />
</p:inputText></f:facet>
</p:cellEditor>
</p:columns>
<p:column id="endgrades" headerText="Endnote">
<h:outputText id="endgrade" value="#{studentsTableView.getEndGrade(exam, student)}" />
</p:column>
<p:column headerText="Formel">
<p:selectBooleanButton id="value1" value="true" onLabel="Yes" offLabel="No" style="width:60px" />
</p:column>
<p:column headerText="Kommentar">
<p:commandButton id="public" icon="ui-icon-comment" type="button" >
<p:ajax event="click" listener="#{studentsTableView.setPublicCommentInfos(exam, student)}" update="publicarea" />
</p:commandButton>
<p:overlayPanel id="imagePanel" for="public" hideEffect="fade">
<h:inputTextarea id="publicarea" value="#{studentsTableView.publicComment}" >
<p:ajax event="change" update="publicarea" />
</h:inputTextarea>
</p:overlayPanel>
<p:commandButton id="private" icon="ui-icon-locked" type="button" >
<p:ajax event="click" listener="#{studentsTableView.setPrivateCommentInfos(exam, student)}" update="privatearea" />
</p:commandButton>
<p:overlayPanel id="privatepanel" for="private" hideEffect="fade">
<h:inputTextarea id="privatearea" value="#{studentsTableView.privateComment}" >
<p:ajax event="change" update="privatearea" />
</h:inputTextarea>
</p:overlayPanel>
</p:column>
</p:dataTable>
</p:tab>
</p:tabView>
</h:form>
Your problem could be because you're still referencing the datatable id from the first tab, even though you switched to another. You could try to create a different id for each datatable from each tab and then working with those ids and updating them.

update inputtext via dialog

Please help me to find a example to update p:inputtext with data stored in a bean which is set(solved already) by selecting a row of a datatable of a p:dialog. I have succeeded updating outputtext in the same manner.
I am using (learning) netbeans 7.2 primefaces 3.2, glassfish 3.1
thansk for all your help
rs_ncs
Look at primefaces showcase and the user guide, you'll find everything you need; in detail search for rowSelect event for the datatable component. Good luck =)
If you would like to update a component on select of a row from a datatable, then you can use the update attribute of a <p:ajax> which is listening on rowselect event. Something like this:
<p:ajax event="rowSelect" update=":xx:xx" />
As Suggested by BalusC the code <p:ajax event="rowSelect" update=":xx:xx" /> should work....
Here is an example of updating both inputtext and outputtext .
<h:form>
<p:dataTable id="usertable" var="user" value="#{userManageBean.userList}"
rowKey="#{user.U_ID}" selection="#{userManageBean.selectedUser}"
selectionMode="single" paginator="true" rows="18" >
<p:ajax event="rowSelect" update=":useredit:edituser" />
<p:ajax event="rowSelect" update=":viewuser:displayuser" />
<p:column headerText="User Name">
<h:outputText value="#{user.username}" />
</p:column>
<p:column headerText="FName">
<h:outputText value="#{user.firstname}" />
</p:column>
<p:column headerText="LName">
<h:outputText value="#{user.lastname}" />
</p:column>
</p:dataTable>
</h:form>
<p:dialog id="userview" header="View User" widgetVar="dlg2" >
<h:form id="viewuser">
<h:panelGrid id="displayuser" columns="2" cellpadding="4">
<h:outputText value="User Name:" />
<h:outputText value="#{userManageBean.selectedUser.username}" />
<h:outputText value="First Name" />
<h:outputText value="#{userManageBean.selectedUser.firstname}" />
<h:outputText value="Last Name:" />
<h:outputText value="#{userManageBean.selectedUser.lastname}" />
</h:panelGrid>
</h:form>
</p:dialog>
<p:dialog id="user_edit" header="Edit User" widgetVar="dlgedit" >
<h:form id="useredit">
<h:panelGrid id="edituser" columns="2" cellpadding="4">
<h:outputText value="First Name" />
<h:inputText value="#{userManageBean.selectedUser.firstname}" />
<h:outputText value="Last Name" />
<h:inputText value="#{userManageBean.selectedUser.lastname}" />
<p:commandButton id="updateUser" value="Add" action="#{someaction}"
ajax="false" />
</h:panelGrid>
</h:form>
</p:dialog>

Accessing invisible tabs in primefaces

I tried to update a Gmap which placed in a tabView. But i am getting the
java.lang.IllegalArgumentException: tab2
error. I have searched this problem a little and noticed that it is available only if tab is visible. So what can I do ? The code block is below:
<h:form id="form">
<p:tabView orientation="left" id="tabView" styleClass="tabView">
<p:ajax event="tabChange" listener="#{sucBean.onTabChange}"
update=":form:tabView:map" />
<p:tab title="Bütün Suçlar" id="tab1">
<p:gmap zoom="10" type="HYBRID" center="40.78470,29.94873" id="map"
model="#{sucBean.advancedModel}"
style="width:740px;height:500px;margin:-14px 0 0 -10px;">
<p:ajax event="overlaySelect" listener="#{sucBean.onMarkerSelect}" />
<p:gmapInfoWindow>
<p:outputPanel
style="text-align:justify;display:block;margin:auto:">
<p:panelGrid columns="2" cellpadding="8">
<h:outputText value="Suç Tipi:" style="color:red" />
<h:outputText value="#{sucBean.marker.data.sucTipi}" />
<h:outputText value="Tarih: " style="color:red" />
<h:outputText value="#{sucBean.marker.data.islenmeZamani}" />
<h:outputText value="Adres: " style="color:red" />
<h:outputText value="#{sucBean.marker.data.adres}" />
<h:outputText value="Suçu İşleyen:" style="color:red" />
<h:outputText value="#{sucBean.marker.data.isleyenBilgisi}" />
</p:panelGrid>
</p:outputPanel>
</p:gmapInfoWindow>
</p:gmap>
</p:tab>
<p:tab title="Suç Ara" id="tab2">
<p:fieldset legend="Ayrıntılı Arama" styleClass="searchField"
id="fieldSet">
<p:panelGrid columns="4" cellpadding="10">
<p:inputText value="#{sucBean.arananKelime}" style="width:300px" />
<h:outputText value=" Kriter:" />
<p:selectOneMenu value="#{sucBean.aramaKriteri}">
<f:selectItem itemLabel="Suç Tipi" itemValue="sucTipi" />
<f:selectItem itemLabel="Adres" itemValue="adres" />
<f:selectItem itemLabel="İşlenme Zamanı" itemValue="zaman" />
<f:selectItem itemLabel="Cinsiyet" itemValue="cinsiyet" />
<f:selectItem itemLabel="Yaş" itemValue="yas" />
</p:selectOneMenu>
<p:commandButton value="Ara"
actionListener="#{sucBean.sucKaydiAra}" update="aramaSonucu" />
</p:panelGrid>
</p:fieldset>
<p:dataTable var="suc" value="#{sucBean.sucModel}" paginator="true"
rows="10" id="aramaSonucu" selection="#{sucBean.selectedSuc}">
<p:column selectionMode="multiple" style="width:18px"></p:column>
<p:column headerText="Suç Tipi">
<h:outputText value="#{suc.sucTipi}" />
</p:column>
<p:column headerText="İşlenme Zamanı">
<h:outputText value="#{suc.islenmeZamani}" />
</p:column>
<p:column headerText="Adres">
<h:outputText value="#{suc.adres}" />
</p:column>
<p:column headerText="Suçu İşleyen">
<h:outputText value="#{suc.isleyenBilgisi}" />
</p:column>
<!-- <f:facet name="footer"> -->
<!-- </f:facet> -->
</p:dataTable>
<p:commandButton id="multiSelectButton" actionListener="#{sucBean.secilenleriGetir}" update=":form:tabView:tab2:map2"
value="Secilenleri Haritada Göster" icon="ui-icon-pin-s" />
<p:gmap zoom="12" type="HYBRID" center="40.78470,29.94873"
id="map2" model="#{sucBean.advancedModel2}"
style="width:740px;height:300px;margin:10px 0 0 -10px;">
When you reference a component inside container components like tabView or accordion, you don't need to include the actual tab id in your update target.
In your case update=":form:tabView:map2" would be the correct update target.

Resources