-
1. Re: more foreach stuff - performance
dhinojosa Apr 5, 2008 3:42 AM (in response to scheintod)Just, curious, were you averse to using the facelet ui:repeat tags?
-
2. Re: more foreach stuff - performance
scheintod Apr 5, 2008 6:13 AM (in response to scheintod)NO! Not at all.
My first version had ui:repeat. Didn't work.
The very core of the project is an extremely detailed template system which allows to determine for each and every object which template to use depending on class and many parameters.
So for every item in a list I have to choose another template to render that spezific object. Looks like
<c:foreach items="handler.getList()" var="item"> <ui:include src="item.template()"> <ui:param name="item" value="#{item}"/> </> </>
As I learnd (the hard way) ui:include doesn't work ui:repeat but only with c:forEach.
-
3. Re: more foreach stuff - performance
dustismo Apr 5, 2008 6:22 AM (in response to scheintod)Not an answer to your forEach problem (though I think creating your list in a getter is generally bad form) -- but I believe icefaces has a dynamic include tag. I have also seen that a couple of other people have been working on one (IMHO should be a basic facelets tag).
Let me know if find something better then the icefaces one.
-Dustin
-
4. Re: more foreach stuff - performance
dhinojosa Apr 5, 2008 6:30 AM (in response to scheintod)Hmmm
<c:foreach items="handler.getList()" var="item"> <ui:include src="item.template()"> <ui:param name="item" value="#{item}"/> </> </>
That code is strange to me, especially with parenthesis.
<c:foreach items="#{handler.list}" var="item"> <ui:include src="#{item.template}"> <ui:param name="item" value="#{item}"/> </ui:include> </c:foreach>
Is there any reason why the above wouldn't work?
-
5. Re: more foreach stuff - performance
scheintod Apr 5, 2008 2:59 PM (in response to scheintod)sorry. It was pretty late and I was to lazy to write the full closing tags.
Changing #{handler.getList()} to #{handler.list} doesn't make any differences. Both result in handler.getList().get( i ).getXyz() code.
-
6. Re: more foreach stuff - performance
scheintod Apr 5, 2008 3:43 PM (in response to scheintod)Hi
I cant even find the icefaces one.
http://www.icesoft.com/developer_guides/icefaces/tld/index.html
In icefaces tutorial I only find references to ui:include which is servlets.
Meanwhile I changed my handler from @Stateless to EVENT scope. This way I can
cache
the generated List. This reduces the complete runtime from 10s to 2s. But event this is at least 20x to slow to use in production.Considering the generated code which would look like
handler.getNavigation().get(0).getA() ... handler.getNavigation().get(0).getZ() handler.getNavigation().get(1).getA() ... handler.getNavigation().get(100).getZ()
I even tried changing the List from LinkedList to ArrayList to give it better indexed performance but with little to no effect.
Since there isn't anything else I can blame, I suspect the
getNavigation() to be the problem because it requires seam the complete seam bijection processing before and after invocation which could slow it down so much.The bad here is that there is really no need for the getNavigation to be called a few thousand times. What I'm looking for simply a way to have a iterator-tag-thingy which only fetches its list one time.
-
7. Re: more foreach stuff - performance
dustismo Apr 5, 2008 7:20 PM (in response to scheintod)Looks like icefaces overrides the regular ui:include tag..
http://facestutorials.icefaces.org/tutorial/dynamic-includes-tutorial.html
-Dustin
-
8. Re: more foreach stuff - performance
scheintod Apr 5, 2008 8:18 PM (in response to scheintod)I see no indication for that after reading that page.
The example uses ui:include like any other application. The
dynamic
behaviour here is the same as with any other ui:include calls and no ui:repeat is used. (Let alone the title:How to use Facelets dynamic include
) -
9. Re: more foreach stuff - performance
pmuir Apr 6, 2008 7:19 PM (in response to scheintod)
Florian Bantner wrote on Apr 05, 2008 01:23 AM:
But it would be better, if there was some way of simply reducing this mess to only one call.There is none I know of. I suggest outjecting the result of handler.getList() to the event context, and then referring to the outjected variable on the page. In that way you avoid the overhead of interceptors, bijection etc.
-
10. Re: more foreach stuff - performance
scheintod Apr 10, 2008 7:52 PM (in response to scheintod)Hi Pete,
thanks for the reply. That's what I've done by now in order to get it to run at least at clickable speed. But I am still looking for a better solution since for comming versions I have to build something like
<c:forEach items="handler.getMenu( 'title' )" var="item"> do stuff </c:forEach>
and I have no idea how I would do that with outjection.
Best regards
-
11. Re: more foreach stuff - performance
visumagic Nov 6, 2008 5:53 PM (in response to scheintod)hi Florian ,
Are you able to implement forEach, im facing serious problem here , is this a bug in seam.
While using iterators c:forLoop,ui:repeat,on list type variables in seam context, the indexing variable's properties are not available inside the loop.example:
<ui:repeat value="#{CollegeProfile.collegeCourses}" var="coursei"> <s:label title="${coursei.title}"></s:label> </ui:repeat>
thanks
raghu -
12. Re: more foreach stuff - performance
scheintod Nov 14, 2008 3:46 PM (in response to scheintod)Hi Raghu,
sorry. My problem was once and for all solved by not using ejb at all.
Regards,
Florian