logo       

Re: JSF, Facelets & Recursion: msg#00148

java.facelets.user

Subject: Re: JSF, Facelets & Recursion


<t:dataTable var="item"
value="#{ (isOrderItem==true) ? entity.orderItems :
entity.subWorkorders }"
> .....
<d:workorder-tree entity="#{item}" isOrderItem="true" />
.....

</t:dataTable>

You have a bad combination of build-time and render-time tags: http://wiki.java.net/bin/view/Projects/FaceletsFAQ#Why_doesn_t_my_c_if_ui_repeat_ui

You really need a component which supports a hierarchical model, such as Tomahawks t:tree2 or the Quipukit treetable:
http://www.teamdev.com/quipukit/component_index.jsf#treetable

Alternatively, if your recursion is going to have a maximum depth, you could nest a fixed number of tables and used their rendered attribute to display or hide them.

<h:dataTable var="item1">
<h:dataTable var="item1child" rendered="item1.hasChildren">
<h:dataTable var="item1childchild"
rendered="item1child.hasChildren">

....

You could probably take advantage of facelets' tag file or include features to reuse some code here, but you have to be very careful when mixing build and render-time expressions (as you've discovered).

Roger


And in another xhtml-page I have


<d:workorder-tree entity="#{WorkorderBean.woEntity}" isOrderItem="false" />



Some more explanation:

- the first call to this fragment displays the sub-workorders

- each sub-workorder can contain a list of order-items

- each order-item can contain a list of order-items

- if an order-item contains an empty list, the div with id="div_#{item.nodeId}" must be empty or not rendered


So could someone help to determine what’s wrong with the use and reference my own el variables which causes recursion not to work.


Any help greatly appreciated

Many thanks

Kind Regards

Roel



Roel De Nijs

Consultant

Business Solutions & Development

E-mail adres: Roel.DeNijs@xxxxxx <mailto:Roel.DeNijs@xxxxxx>


MSP n.v.

Veldkant 7

2550 Kontich

Tel : +32 (0)3 454 27 28

Fax :+32 (0)3 454 27 88

http://www.msp.be <http://www.msp.be/> - info@msp. be <mailto:info@xxxxxx>


Ondernemingsnummer: BTW-BE-0870.749.501

The information contained in this transmission is proprietary and confidential and is intended only for the use of the individual or entity named above. If the reader of this message is not the intended recipient, the reader is notified that any consideration, dissemination or duplication of this communication is strictly prohibited.

------------------------------------------------------------------------

*From:* jacob@xxxxxxxxxx [mailto:jacob@xxxxxxxxxx]
*Sent:* maandag 21 mei 2007 19:49
*To:* users@xxxxxxxxxxxxxxxxxxxxx
*Subject:* RE: JSF, Facelets & Recursion


Everytime this issue has come up, it's been traced back to a developer issue with how they were referencing their own EL variables, nothing to do with Facelets/EL/JSF itself.




Hello all,

I'm working with JSF (MyFaces) and Facelets. I've created a custom facelet (more precise: via a seperate xhtml-file), containing a tomahawk data-table

But one big problem: in this file there is a reference to itselfs, because i have to represent a custom tree structure (with checkboxes to delete and create new nodes/subtrees). so it's seems logical to solve this recursively, but if i do so, i get a stack-overflow-error.

I'm searching and surfing the net for 2-3 days looking for a solution to this problem, but apparently it doesn't exist (while in my opinion this is a very straight forward problem).

and i tried everything i know of:
- using the rendered-attribute as the step-out-endless-loop thing but i've read that the component tree contains all components and that afterwards the rendered ones are really rendered and the others aren't, so that's not a solution
- i also tried with some jstl and the ifhandler, but also learned that there is a big difference in when the expression is evaluated.
- also tried with some dynamic form of the jsfc-attribute, resulting in a "ui : remove" if the component hadn't to be rendered, but also no luck
- ...

So i was wondering: is there a solution for this or some other things i could try, because it's really frustrating me :censored:

any tips, hints and/or suggestions are more than welcome
thanks in advance
Roel


--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxxxxxxx


--
----------------------------------------
Ninth Avenue Software
p: +61 7 3137 1351 (UTC +10)
f: +61 7 3102 9141
w: http://www.ninthavenue.com.au
e: info@xxxxxxxxxxxxxxxxxx
----------------------------------------


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise