You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Shawn Recinto <sr...@iesabroad.org> on 2006/09/19 15:01:57 UTC

Problem using dataTable, selectOneMenu and selectBooleanCheckbox together

Hey guys,

I running into an issue when using a dataTable (tomahawk or core) with
selectOneMenu and selectBooleanCheckbox, for some reason its values are
getting "defaulted" or "lost" i.e. on a selectOneMenu bound to a value
object from a collection in the backing bean, where I have verified that
the value is set correctly up until the point it started rendering the
table, some render process sets the value to empty string, similar with
the selectBooleanCheckbox except the value always gets set to false.  I
purposely set the values to "true" in the UI and placed an exception for
the check box for anything that set it to false and here is the sample
stack trace I get.  This occurs on the rendering phase of the life cycle
i.e. Response phase

 

com.ies.common.error.IESRuntimeException: This should not be false

        at
com.ies.scholar.vo.form.FormInstanceVO.setAccessable(FormInstanceVO.java
:300)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)

        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)

        at java.lang.reflect.Method.invoke(Method.java:585)

        at
org.apache.myfaces.el.PropertyResolverImpl.setProperty(PropertyResolverI
mpl.java:406)

        at
org.apache.myfaces.el.PropertyResolverImpl.setValue(PropertyResolverImpl
.java:173)

        at
com.sun.facelets.el.LegacyELContext$LegacyELResolver.setValue(LegacyELCo
ntext.java:201)

        at com.sun.el.parser.AstValue.setValue(AstValue.java:113)

        at
com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:246)

        at
com.sun.facelets.el.TagValueExpression.setValue(TagValueExpression.java:
93)

        at
com.sun.facelets.el.LegacyValueBinding.setValue(LegacyValueBinding.java:
68)

        at javax.faces.component.UIInput.updateModel(UIInput.java:269)

        at
javax.faces.component.UIInput.processUpdates(UIInput.java:206)

        at javax.faces.component.UIData.process(UIData.java:733)

        at
javax.faces.component.UIData.processColumnChildren(UIData.java:714)

        at javax.faces.component.UIData.processUpdates(UIData.java:622)

        at
org.apache.myfaces.component.html.ext.HtmlDataTableHack.processUpdates(H
tmlDataTableHack.java:133)

        at
org.apache.myfaces.component.html.ext.HtmlDataTable.processUpdates(HtmlD
ataTable.java:379)

        at
javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.jav
a:645)

        at
javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.jav
a:645)

        at javax.faces.component.UIForm.processUpdates(UIForm.java:87)

        at
javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.jav
a:645)

        at
javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:157)

        at
org.apache.myfaces.lifecycle.LifecycleImpl.updateModelValues(LifecycleIm
pl.java:302)

        at
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:81
)

        at
javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)

        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:252)

        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:173)

        at
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFil
ter.java:97)

        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:202)

        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:173)

        at
com.ies.common.ui.common.filter.HibernateSessionFilter.doFilter(Hibernat
eSessionFilter.java:43)

        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:202)

        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:173)

        at
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFil
ter.java:144)

        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:202)

        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:173)

        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:213)

        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.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:1
48)

        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:86
9)

        at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.proc
essConnection(Http11BaseProtocol.java:664)

        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint
.java:527)

        at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollow
erWorkerThread.java:80)

        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:684)

        at java.lang.Thread.run(Thread.java:595)

 

This stack trace represents the custom exception I threw when something
from the component when through its processUpdates cycle. 

 

Here is some sample code:

 

"from the JSF page"

<t:dataTable id="centerInstanceList"

var="centerForm"

      value="#{ formBean.formInstances}"

      styleClass="detailsGrid" 

      headerClass="detailsHeader" 

      rowClasses="detailsOnRow,detailsOffRow"

      rowCountVar="rowCount"

      rowIndexVar="rowIndex">

      ...

      <t:column   style="width:10%">

<f:facet name="header">

<h:outputText value="#{messages.form_center_list_empDoc}" />

</f:facet>

            <t:selectOneMenu value="#{centerForm.docuId}">

                  <f:selectItems value="#{formBean.documentSelectItems}"
/>

            </t:selectOneMenu>

      </t:column>

      ...

      <t:column   style="width:5%"> 

<f:facet name="header">

<h:outputText value="#{messages.form_center_list_Sta}" />

</f:facet>

<t:selectBooleanCheckbox value="#{centerForm.accessable}"/>

</t:column>

</t:dataTable>

 

 

My FormInstanceVO is a pojo except for my debug exception code snippets
(from backing bean formBean.formInstances)

 

public Boolean getAccessable() {

                        return this.accessable;

            }           

 

public void setAccessable(Boolean accessable) {

                        if(Boolean.FALSE.equals(accessable)) {

                                    IESRuntimeException e = new
IESRuntimeException("This should not be false");

                                    e.printStackTrace();

                                    throw e;

                        }

                        this.accessable = accessable;

            }

 

 

An interesting thing to note is that if I change any of these it a
<h:inputText /> or an <h:outputText /> it correctly display the values
that are in the VOs

 

Could someone help me figure out what I am missing? Why would the
dataTable override the values that were preset in the value objects for
a selectBooleanCheckbox or selectOneMenu?

 

I am using MyFaces 1.3

Facelets 1.1.11

hibernate-3.2.0.cr2

Spring Framework 1.2.8

 

Running on apache-tomcat-5.5.17

 

TIA

 

Regards,

Shawn Recinto