You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Butash, Bob" <bo...@eds.com> on 2008/04/23 14:29:23 UTC

RE: [Trinidad] Referencing Complex Objects inside a table

Was wondering if anyone else has any additional suggestions.

Thanks,

Bob

-----Original Message-----
From: Butash, Bob [mailto:bob.butash@eds.com] 
Sent: Tuesday, April 22, 2008 12:28 PM
To: MyFaces Discussion
Subject: RE: Referencing Complex Objects inside a table

Simon,

Thanks for the response...let me address your questions:

varStatus - Table has an attribute that you can set to hold onto the
status of the index processing.  So if on the table you provide a <name>
to the varStatus you can then use <name>.index to get the current index
of the row you are processing.  I'm not using this right now, since I
thought this could be a potential work around for the issue at hand.

You are correct the name should be bobject, since it is not the list.
But it is a local name that is not used elsewhere, so there should be no
issues there.

AObject's bobjectList is a lazy initialed ArrayList.

In my scenario I am only ever putting one object in the list.  I planned
on adding an add row button to add a row to the list, but have not
gotten that far due to this issue.

I would love to have it be an issue in my code, but I have spent a lot
of time looking into this issue as well as I have had additional
co-workers looking into without being able to uncover anything.  I have
replicated the issue using the Trinidad iterate tag as well.  Once again
it is only an issue with a complex object that is on an object in a
list.

Any additional insight or assistance would be appreciated.

Thanks,

Bob

-----Original Message-----
From: simon.kitching@chello.at [mailto:simon.kitching@chello.at]
Sent: Tuesday, April 22, 2008 11:50 AM
To: MyFaces Discussion
Subject: Re: Referencing Complex Objects inside a table

I'm not sure what you mean by "the varStatus's index".

You currently use var="bobjectList". This would be better named: 
var="bobject" as the var is set to each element of the table's "value"
list in turn, ie refers to an element from the bobjectList, not the
entire list. However the var does seem to be used ok.

The fact that this is a session-scoped bean does remove a lot of
potential failures here (although session-scoped vars have lots of
problems of their own).

Is the bobjectList a normal ArrayList or LinkedList, or is it something
special?

Are you sure that it is failing on the zeroth element during postback?
Maybe element zero is ok, but some other later element is failing.
Adding some logging statements would again be useful here..

To be honest, if I were a gambler, I would give odds of 20:1 that this
*is* a problem in your code. Though it isn't an obvious one...

Regards,
Simon

Butash, Bob schrieb:
>  
> Simon,
>
> Thanks for the quick response however, the object is a session scoped 
> managed bean.  So it would still be available.
>
> When I changed the code to
> manageAdminAobject.bobjectList[0].eobject.value the code worked, 
> however when I tried to set up the varStatus's index to replace the 
> hard coded 0 it failed.
>
> Thanks,
>
> Bob
>
> -----Original Message-----
> From: simon.kitching@chello.at [mailto:simon.kitching@chello.at]
> Sent: Tuesday, April 22, 2008 11:28 AM
> To: MyFaces Discussion
> Subject: Re: Referencing Complex Objects inside a table
>
> My guess would be that you have everything set up correctly for
render.
> But that on postback your bobject list contains uninitialised objects.
> Primitive values on it will be reassigned from the posted data so 
> maybe you didn't notice.
>
> Is your manageAdminAobject in request scope?
>
> I have not heard of any EL bug that correctly resolves expressions 
> during render phase, but fails during postback phase.
>
> Regards,
> Simon
>
> Butash, Bob schrieb:
>   
>> Hello,
>>
>> I'm in need of some assistance.  I have a complex object hierarchy 
>> that I'm trying to create a JSF view for.  I have simplified it to 
>> the
>>     
>
>   
>> point where I still get the error.  Here is the setup:
>>
>> Aobject that contains a list of Bobjects.  Bobject contains an 
>> Eobject
>>     
>
>   
>> and then Eobject has a value attribute.
>>
>> Here is what I was trying to do in the jspx, note I am using Trinidad

>> with facelets:
>>
>> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
>>         xmlns:ui="http://java.sun.com/jsf/facelets"
>>         xmlns:h="http://java.sun.com/jsf/html"
>>         xmlns:f="http://java.sun.com/jsf/core"
>>         xmlns:tr="http://myfaces.apache.org/trinidad">
>>         <ui:composition template="/view/template.jspx">
>>                 <ui:define name="content">
>>                         <h:form>
>>                                 <tr:panelHeader
>>                                        
>>
>>     
> text="#{messages['com.eds.employeetracker.entity.admin.Aobject.search.
> he
> ader']}"
>   
>>                                         messageType="none" />
>>                                 <tr:panelHorizontalLayout
>>     
> halign="left">
>   
>>                                         <tr:panelFormLayout>
>>                                                 <tr:panelBox 
>> background="transparent" inlineStyle="width: 100%;">
>>                                                         
>> <tr:panelHeader
>>                                                                
>>
>>     
>
text="#{messages['com.eds.employeetracker.entity.admin.Aobject.label']}"
>   
>> />
>>
>>                                                         <tr:inputText
>>                                                                
>>
>>     
> label="#{messages['com.eds.employeetracker.entity.admin.Zobject.zvalue
> .l
> abel']}"
>   
>>                                                                
>> value="#{manageAdminAobject.zvalue}" />
>>                                                         <tr:inputText
>>                                                                
>>
>>     
> label="#{messages['com.eds.employeetracker.entity.admin.Aobject.avalue
> .l
> abel']}"
>   
>>                                                                
>> value="#{manageAdminAobject.avalue}" />
>>                                                         <tr:table 
>> id="bobjectListTable"
>>                                                                
>> value="#{manageAdminAobject.bobjectList}" var="bobjectList">
>>
>>                                                                
>> <tr:column
>>                                                                
>>        
>> headerText="#{messages['com.eds.employeetracker.entity.admin.Eobject.
>> e
>> value.label']}">
>>
>>                                                                
>>         <tr:inputText
>>                                                                
>>                
>>
>>     
> label="#{messages['com.eds.employeetracker.entity.admin.Eobject.evalue
> .l
> abel']}"
>   
>>                                                                
>>                 value="#{bobjectList.eobject.evalue}" />
>>
>>                                                                
>> </tr:column>
>>                                                         </tr:table>
>>                                                        
>> <tr:panelButtonBar>
>>                                                                
>> <tr:commandButton text="#{messages['command.label.add']}"
>>
>>                                                                
>>         action="#{view$admin$aobjectManage.addAction}" />
>>
>>                                                        
>> </tr:panelButtonBar>
>>                                                 </tr:panelBox>
>>                                         </tr:panelFormLayout>
>>                                 </tr:panelHorizontalLayout>
>>                         </h:form>
>>                 </ui:define>
>>         </ui:composition>
>> </jsp:root>
>>
>> The page renders properly, however when I try to submit the page I 
>> get
>>     
>
>   
>> the following error:
>>
>> WARNING: executePhase(RENDER_RESPONSE 
>> 6,org.apache.myfaces.trinidadinternal.context.FacesContextFactoryImpl
>> $
>> CacheRenderKit@171570)
>> threw exception
>>
>> _javax.el.ELException_: /view/admin/aobjectManage.jspx @29,51
>> value="#{bobjectList.eobject.evalue}": Target Unreachable, 'eobject'
>> returned null
>>
>>         at
>> org.apache.myfaces.trinidad.bean.ValueBindingValueExpression.isReadOn
>> l
>> y(_ValueBindingValueExpression.java:83_)
>>
>>         at
>> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.EditableValu
>> e
>> Renderer.getReadOnly(_EditableValueRenderer.java:244_)
>>
>>         at
>> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.FormElementR
>> e
>> nderer.renderAsElement(_FormElementRenderer.java:217_)
>>
>>         at
>> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.InputLabelAn
>> d
>> MessageRenderer.getLabelFor(_InputLabelAndMessageRenderer.java:78_)
>>
>>         at
>> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.LabelAndMess
>> a
>> geRenderer$Label.getForId(_LabelAndMessageRenderer.java:617_)
>>
>>         at
>> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.OutputLabelR
>> e
>> nderer.encodeAll(_OutputLabelRenderer.java:89_)
>>
>>         at
>> org.apache.myfaces.trinidad.render.CoreRenderer.delegateRenderer(_Cor
>> e
>> Renderer.java:330_)
>>
>>         at
>> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.LabelAndMess
>> a
>> geRenderer.encodeAll(_LabelAndMessageRenderer.java:193_)
>>
>>         at
>> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.InputLabelAn
>> d
>> MessageRenderer.encodeAll(_InputLabelAndMessageRenderer.java:120_)
>>
>> As stated the page does render fine as well as I do have the 
>> Aobject's
>>     
>
>   
>> list of Bobjects initilized, as well as the Bobject's Eobject is 
>> initialized
>>
>>        * if* (manageAdminAobject.getId() ==* null*)
>>         {
>>                 manageAdminAobject.getBobjectList().add(
>>                                * new* 
>> com.eds.employeetracker.entity.admin.Bobject());
>>
manageAdminAobject.getBobjectList().get(0).setEobject(
>>                                * new* 
>> com.eds.employeetracker.entity.admin.Eobject());
>>                 setManagedBean("manageAdminAobject",
>>     
> manageAdminAobject);
>   
>>         }
>>
>> It seems that it doesn't handle a complex nested objects, as there 
>> are
>>     
>
>   
>> no issues with any non-complex value that is directly on the Bobject.
>> Has anyone else seen this behavior and is there a way around it??
>>
>> Any help would be greatly appreciated as, like most people, I'm under

>> a huge time crunch to get the working.
>>
>> Thanks,
>>
>> Bob
>>
>>     
>
>
>   


Re: [Trinidad] Referencing Complex Objects inside a table

Posted by "simon.kitching@chello.at" <si...@chello.at>.
Have you tried to duplicate this issue using just the standard
h:dataTable component?

If it does not fail with h:dataTable then the Trinidad people might get
more interested. Alternatively, if it does fail with h:dataTable then
that is also useful to know, and you can repost without trinidad in the
subject line.

Also checking with jsp vs facelets would be useful. If the problem only
happens with Facelets, then that narrows things down.

Regards,
Simon


Regards,
Simon

Butash, Bob schrieb:
> Was wondering if anyone else has any additional suggestions.
>
> Thanks,
>
> Bob
>
> -----Original Message-----
> From: Butash, Bob [mailto:bob.butash@eds.com] 
> Sent: Tuesday, April 22, 2008 12:28 PM
> To: MyFaces Discussion
> Subject: RE: Referencing Complex Objects inside a table
>
> Simon,
>
> Thanks for the response...let me address your questions:
>
> varStatus - Table has an attribute that you can set to hold onto the
> status of the index processing.  So if on the table you provide a <name>
> to the varStatus you can then use <name>.index to get the current index
> of the row you are processing.  I'm not using this right now, since I
> thought this could be a potential work around for the issue at hand.
>
> You are correct the name should be bobject, since it is not the list.
> But it is a local name that is not used elsewhere, so there should be no
> issues there.
>
> AObject's bobjectList is a lazy initialed ArrayList.
>
> In my scenario I am only ever putting one object in the list.  I planned
> on adding an add row button to add a row to the list, but have not
> gotten that far due to this issue.
>
> I would love to have it be an issue in my code, but I have spent a lot
> of time looking into this issue as well as I have had additional
> co-workers looking into without being able to uncover anything.  I have
> replicated the issue using the Trinidad iterate tag as well.  Once again
> it is only an issue with a complex object that is on an object in a
> list.
>
> Any additional insight or assistance would be appreciated.
>
> Thanks,
>
> Bob
>
> -----Original Message-----
> From: simon.kitching@chello.at [mailto:simon.kitching@chello.at]
> Sent: Tuesday, April 22, 2008 11:50 AM
> To: MyFaces Discussion
> Subject: Re: Referencing Complex Objects inside a table
>
> I'm not sure what you mean by "the varStatus's index".
>
> You currently use var="bobjectList". This would be better named: 
> var="bobject" as the var is set to each element of the table's "value"
> list in turn, ie refers to an element from the bobjectList, not the
> entire list. However the var does seem to be used ok.
>
> The fact that this is a session-scoped bean does remove a lot of
> potential failures here (although session-scoped vars have lots of
> problems of their own).
>
> Is the bobjectList a normal ArrayList or LinkedList, or is it something
> special?
>
> Are you sure that it is failing on the zeroth element during postback?
> Maybe element zero is ok, but some other later element is failing.
> Adding some logging statements would again be useful here..
>
> To be honest, if I were a gambler, I would give odds of 20:1 that this
> *is* a problem in your code. Though it isn't an obvious one...
>
> Regards,
> Simon
>
> Butash, Bob schrieb:
>   
>>  
>> Simon,
>>
>> Thanks for the quick response however, the object is a session scoped 
>> managed bean.  So it would still be available.
>>
>> When I changed the code to
>> manageAdminAobject.bobjectList[0].eobject.value the code worked, 
>> however when I tried to set up the varStatus's index to replace the 
>> hard coded 0 it failed.
>>
>> Thanks,
>>
>> Bob
>>
>> -----Original Message-----
>> From: simon.kitching@chello.at [mailto:simon.kitching@chello.at]
>> Sent: Tuesday, April 22, 2008 11:28 AM
>> To: MyFaces Discussion
>> Subject: Re: Referencing Complex Objects inside a table
>>
>> My guess would be that you have everything set up correctly for
>>     
> render.
>   
>> But that on postback your bobject list contains uninitialised objects.
>> Primitive values on it will be reassigned from the posted data so 
>> maybe you didn't notice.
>>
>> Is your manageAdminAobject in request scope?
>>
>> I have not heard of any EL bug that correctly resolves expressions 
>> during render phase, but fails during postback phase.
>>
>> Regards,
>> Simon
>>
>> Butash, Bob schrieb:
>>   
>>     
>>> Hello,
>>>
>>> I'm in need of some assistance.  I have a complex object hierarchy 
>>> that I'm trying to create a JSF view for.  I have simplified it to 
>>> the
>>>     
>>>       
>>   
>>     
>>> point where I still get the error.  Here is the setup:
>>>
>>> Aobject that contains a list of Bobjects.  Bobject contains an 
>>> Eobject
>>>     
>>>       
>>   
>>     
>>> and then Eobject has a value attribute.
>>>
>>> Here is what I was trying to do in the jspx, note I am using Trinidad
>>>       
>
>   
>>> with facelets:
>>>
>>> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
>>>         xmlns:ui="http://java.sun.com/jsf/facelets"
>>>         xmlns:h="http://java.sun.com/jsf/html"
>>>         xmlns:f="http://java.sun.com/jsf/core"
>>>         xmlns:tr="http://myfaces.apache.org/trinidad">
>>>         <ui:composition template="/view/template.jspx">
>>>                 <ui:define name="content">
>>>                         <h:form>
>>>                                 <tr:panelHeader
>>>                                        
>>>
>>>     
>>>       
>> text="#{messages['com.eds.employeetracker.entity.admin.Aobject.search.
>> he
>> ader']}"
>>   
>>     
>>>                                         messageType="none" />
>>>                                 <tr:panelHorizontalLayout
>>>     
>>>       
>> halign="left">
>>   
>>     
>>>                                         <tr:panelFormLayout>
>>>                                                 <tr:panelBox 
>>> background="transparent" inlineStyle="width: 100%;">
>>>                                                         
>>> <tr:panelHeader
>>>                                                                
>>>
>>>     
>>>       
> text="#{messages['com.eds.employeetracker.entity.admin.Aobject.label']}"
>   
>>   
>>     
>>> />
>>>
>>>                                                         <tr:inputText
>>>                                                                
>>>
>>>     
>>>       
>> label="#{messages['com.eds.employeetracker.entity.admin.Zobject.zvalue
>> .l
>> abel']}"
>>   
>>     
>>>                                                                
>>> value="#{manageAdminAobject.zvalue}" />
>>>                                                         <tr:inputText
>>>                                                                
>>>
>>>     
>>>       
>> label="#{messages['com.eds.employeetracker.entity.admin.Aobject.avalue
>> .l
>> abel']}"
>>   
>>     
>>>                                                                
>>> value="#{manageAdminAobject.avalue}" />
>>>                                                         <tr:table 
>>> id="bobjectListTable"
>>>                                                                
>>> value="#{manageAdminAobject.bobjectList}" var="bobjectList">
>>>
>>>                                                                
>>> <tr:column
>>>                                                                
>>>        
>>> headerText="#{messages['com.eds.employeetracker.entity.admin.Eobject.
>>> e
>>> value.label']}">
>>>
>>>                                                                
>>>         <tr:inputText
>>>                                                                
>>>                
>>>
>>>     
>>>       
>> label="#{messages['com.eds.employeetracker.entity.admin.Eobject.evalue
>> .l
>> abel']}"
>>   
>>     
>>>                                                                
>>>                 value="#{bobjectList.eobject.evalue}" />
>>>
>>>                                                                
>>> </tr:column>
>>>                                                         </tr:table>
>>>                                                        
>>> <tr:panelButtonBar>
>>>                                                                
>>> <tr:commandButton text="#{messages['command.label.add']}"
>>>
>>>                                                                
>>>         action="#{view$admin$aobjectManage.addAction}" />
>>>
>>>                                                        
>>> </tr:panelButtonBar>
>>>                                                 </tr:panelBox>
>>>                                         </tr:panelFormLayout>
>>>                                 </tr:panelHorizontalLayout>
>>>                         </h:form>
>>>                 </ui:define>
>>>         </ui:composition>
>>> </jsp:root>
>>>
>>> The page renders properly, however when I try to submit the page I 
>>> get
>>>     
>>>       
>>   
>>     
>>> the following error:
>>>
>>> WARNING: executePhase(RENDER_RESPONSE 
>>> 6,org.apache.myfaces.trinidadinternal.context.FacesContextFactoryImpl
>>> $
>>> CacheRenderKit@171570)
>>> threw exception
>>>
>>> _javax.el.ELException_: /view/admin/aobjectManage.jspx @29,51
>>> value="#{bobjectList.eobject.evalue}": Target Unreachable, 'eobject'
>>> returned null
>>>
>>>         at
>>> org.apache.myfaces.trinidad.bean.ValueBindingValueExpression.isReadOn
>>> l
>>> y(_ValueBindingValueExpression.java:83_)
>>>
>>>         at
>>> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.EditableValu
>>> e
>>> Renderer.getReadOnly(_EditableValueRenderer.java:244_)
>>>
>>>         at
>>> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.FormElementR
>>> e
>>> nderer.renderAsElement(_FormElementRenderer.java:217_)
>>>
>>>         at
>>> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.InputLabelAn
>>> d
>>> MessageRenderer.getLabelFor(_InputLabelAndMessageRenderer.java:78_)
>>>
>>>         at
>>> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.LabelAndMess
>>> a
>>> geRenderer$Label.getForId(_LabelAndMessageRenderer.java:617_)
>>>
>>>         at
>>> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.OutputLabelR
>>> e
>>> nderer.encodeAll(_OutputLabelRenderer.java:89_)
>>>
>>>         at
>>> org.apache.myfaces.trinidad.render.CoreRenderer.delegateRenderer(_Cor
>>> e
>>> Renderer.java:330_)
>>>
>>>         at
>>> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.LabelAndMess
>>> a
>>> geRenderer.encodeAll(_LabelAndMessageRenderer.java:193_)
>>>
>>>         at
>>> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.InputLabelAn
>>> d
>>> MessageRenderer.encodeAll(_InputLabelAndMessageRenderer.java:120_)
>>>
>>> As stated the page does render fine as well as I do have the 
>>> Aobject's
>>>     
>>>       
>>   
>>     
>>> list of Bobjects initilized, as well as the Bobject's Eobject is 
>>> initialized
>>>
>>>        * if* (manageAdminAobject.getId() ==* null*)
>>>         {
>>>                 manageAdminAobject.getBobjectList().add(
>>>                                * new* 
>>> com.eds.employeetracker.entity.admin.Bobject());
>>>
>>>       
> manageAdminAobject.getBobjectList().get(0).setEobject(
>   
>>>                                * new* 
>>> com.eds.employeetracker.entity.admin.Eobject());
>>>                 setManagedBean("manageAdminAobject",
>>>     
>>>       
>> manageAdminAobject);
>>   
>>     
>>>         }
>>>
>>> It seems that it doesn't handle a complex nested objects, as there 
>>> are
>>>     
>>>       
>>   
>>     
>>> no issues with any non-complex value that is directly on the Bobject.
>>> Has anyone else seen this behavior and is there a way around it??
>>>
>>> Any help would be greatly appreciated as, like most people, I'm under
>>>       
>
>   
>>> a huge time crunch to get the working.
>>>
>>> Thanks,
>>>
>>> Bob
>>>
>>>     
>>>       
>>   
>>     
>
>
>