I Found the problem,
The problem only occurs when the preserveDataModel
attribute is set to true in the dataTable.
If I set the preserveDataModel to false, all works
fine.
Someone have this behavior ???
Rogerio
Hi All,
I´m having trouble
with an situation that i think is simple.
I have a collection
of objects that need to be displayed in a data table and updated
later.
The collection in
the backing bean is a ArrayList and polulated with objects of type AttributeVO
that has name and value attributes.
if i associate the
collection in the backing bean with the data table in the page the table is
displayed OK, the strange is that if the backing bean have the SETTER for the
data table the page stop working with the following exception
:
Cannot
set value for _expression_ '#{DesktopBean.atributosDesktop}' to a new value of
type br.com.gsb.model.vos.AttributeVO
t
javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
br.com.gsb.view.util.SecurityFilter.doFilter(SecurityFilter.java:60)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:123)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
br.com.gsb.view.util.OpenHibernateSessionFilter.doFilter(OpenHibernateSessionFilter.java:41)
t
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at
java.lang.Thread.run(Thread.java:595)
Looks like JSF is
trying to set the AttributeVO on the Collection field.
Bellow is the
relevant source for the Backing Bean VO and JSP.
VO
-----------------------------------------------------------------------------
public class
AttributeVO extends BaseVO {
private String
name;
private String value;
/**
* @return
Returns the name.
*/
public String getName()
{
return name;
}
/**
* @param name
The name to set.
*/
public void setName(String name)
{
this.name = name;
}
/**
* @return
Returns the value.
*/
public String getValue()
{
return value;
}
/**
* @param value
The value to set.
*/
public void setValue(String value)
{
this.value = value;
}
Backing
Bean
-------------------------------------------------------------------------
private
Collection atributosDesktop = null;
/**
* @param atributosDesktop The atributosDesktop to set.
*/
public void setAtributosDesktop(Collection atributosDesktop)
{
this.atributosDesktop =
atributosDesktop;
}
/**
* @return Returns the atributosDesktop.
*/
public Collection
getAtributosDesktop() {
return
atributosDesktop;
}
JSP
--------------------------------------------------------------------------------------
<x:dataTable
id="data" width="99%" border="0"
styleClass="standardTable"
headerClass="standardTable_Header"
rowClasses="standardTable_Row1,standardTable_Row2"
columnClasses="standardTable_ColumnCentered,
standardTable_ColumnCentered, standardTable_ColumnRight,
standardTable_ColumnRight"
var="row"
preserveDataModel="true"
value="#{DesktopBean.atributosDesktop}"
rows="10">
<h:column>
<f:facet
name="header">
<h:outputText
id="hdrNome" value="Nome Atributo" />
</f:facet>
<h:outputText
value="#{row.name}" />
</h:column>
<h:column>
<f:facet
name="header">
<h:outputText
id="hdrValor" value="Valor" />
</f:facet>
<h:inputText
value="#{row.value}" size="80" />
</h:column>
</x:dataTable>
Thanks in
advance
Rogerio
"Essa mensagem é destinada exclusivamente ao seu
destinatário e pode
conter informações confidenciais, protegidas por
sigilo profissional ou
cuja divulgação seja proibida por lei. O uso não
autorizado de tais
informações é proibido e está sujeito às penalidades
cabíveis.
This message is intended exclusively for its
addressee and may contain
information that is confidential and protected by a
professional
privilege or whose disclosure is prohibited by law.
Unauthorized use of
such information is prohibited and subject to
applicable penalties."
"Essa mensagem é destinada exclusivamente ao seu destinatário e pode
conter informações confidenciais, protegidas por sigilo profissional ou
cuja divulgação seja proibida por lei. O uso não autorizado de tais
informações é proibido e está sujeito às penalidades cabíveis.
This message is intended exclusively for its addressee and may contain
information that is confidential and protected by a professional
privilege or whose disclosure is prohibited by law. Unauthorized use of
such information is prohibited and subject to applicable penalties."