dev@jsftemplating.java.net

Re: JSFTemplating: Samples for using for() loop

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Fri, 27 Oct 2006 22:40:47 -0700

There isn't any support right now for a for loop in a page. There is
support when defining a component (foreach & while), but I know you're
looking for this in the context of a page. The difference between the 2
contexts is one is a LayoutElement tree, the other is a UIComponent
tree... in a UIComponent tree, you have to implement the "for"
functionality via a UIComponent, or process it during UIComponent
creation. I may add support for both... but it's not there right now.

In your case, you should just do this in a handler (java code):

FacesContext ctx = handlerCtx.getFacesContext();
Map reqMap = ctx.getExternalContext().getRequestMap();
for (...) {
    reqMap.put("dynId", newValue);
    reqMap.put("otherValue", newOtherValue);
    ...
    LayoutViewHandler(ctx, (UIComponent) ctx.getInputValue("parent"),
(LayoutElement) ctx.getInputValue("elt"));
}

Ken


Anissa Lam wrote:
> Hi Ken,
> Can you provide a sample for using the for() loop? I am not sure
> about the syntax.
>
> thanks
> Anissa.