Hi Karam,
The looping features (currently) exposed in the .jsf file loop at render
time, not at creation time. The table component (I think) needs to know
the # of columns earlier than that. So I don't think this will help you
in this case. Instead, I recommend you create a
"DynamicTableColumnFactory" or something along those lines....
Adding a custom factory will allow you to create as many table columns
as you want and add them to the table. To get started:
* Copy one of the other factories (such as TableColumnFactory.java)
* Write your own "createChild" implementation.
* In the createChild method, use LayoutComponent.getEvaluatedOption(...)
to get values passed in as attributes in the .jsf file. You will be
able to pass in *anything* you want to help you determine what you need
to do to create the TableColumns.
* In the createChild method, create the child components (TableColumns)
and add them to the "parent" (which is passed in as an argument).
(NOTE: you do not have to use "setOptions" or "addChild" methods if they
don't apply for you). You can (and should) also create the children of
the TableColumns here.
That's it! I hope this is what you're looking for.
Good luck!
Ken
Karam Singh Badesha wrote:
> After removing that line it works fine now.
>
> Another question:
> Can you please provide a small example of using for loop in
> jsftemplating page. I need this because the number of table columns is
> dynamic. Here is what I am looking for:
>
> for (int i=0; i<columns; i++)
> {
> wood stock column code
> }
>
> Or is there any other way to take care of this kind of situation.
>
> thanks
> Karam
>
> Ken Paulsen wrote:
>>
>> Ed's Dynamic Faces .js file can only be loaded once or it blows up.
>>
>> Both the Woodstock team and JSFtemplating use a different way of
>> loading the file. I do mark the flag the request, but Woodstock does
>> not... and I'm not sure I'm flagging it in a compatible way anyway.
>> Woodstock does not have a standard way to replace the resource
>> resolution portion of its code.... this needs to be worked out.
>>
>> In the short term, you can remove the <jsfExt:scripts /> tag b/c
>> Woodstock will include the script on every page in your application
>> (that has the <sun:head /> tag). Hopefully soon Woodstock will be
>> compatible with the <jsfExt:scripts /> tag.
>>
>> Ken
>>
>> Karam Singh Badesha wrote:
>>> Ken,
>>> It was in the classpath. I removed it and it seems to be working
>>> fine now. Now I am getting a alert box popup on every page stating:
>>> DynaFaces already defined!
>>> How do I get rid of this alert box popping up on every page.
>>>
>>> Thanks
>>> Karam
>>>
>>> Ken Paulsen wrote:
>>>>
>>>> Are you sure the web/WEB-INF/lib/webui-jsf-dt.jar isn't in your
>>>> classpath? I added this .jar file to my WEB-INF/lib directory and
>>>> started getting the same error you reported. Without it, I have no
>>>> problems.
>>>>
>>>> Ken
>>>>
>>>> Karam Singh Badesha wrote:
>>>>> Hi,
>>>>> I just replaced woodstock jars, jsftemplating jars with the new
>>>>> ones from java.net. Now I can't get my application to run. What
>>>>> did I miss? Application compiles fine. Here is classpath:
>>>>>
>>>>> web/WEB-INF/lib/dataprovider.jar
>>>>> web/WEB-INF/lib/dojo-0.4.1-ajax.jar
>>>>> web/WEB-INF/lib/jsftemplating-dt.jar
>>>>> web/WEB-INF/lib/jsftemplating-dynafaces-0.1.jar
>>>>> web/WEB-INF/lib/jsftemplating.jar
>>>>> web/WEB-INF/lib/json.jar
>>>>> web/WEB-INF/lib/MultipleListDataProvider.jar
>>>>> web/WEB-INF/lib/ojdbc14.jar
>>>>> web/WEB-INF/lib/prototype-1.5.0.jar
>>>>> web/WEB-INF/lib/UsageTracking.jar
>>>>> web/WEB-INF/lib/webui-jsf-dt.jar
>>>>> web/WEB-INF/lib/webui-jsf-suntheme.jar
>>>>> web/WEB-INF/lib/webui-jsf.jar
>>>>> C:/SunAppServer/lib/javaee.jar
>>>>>
>>>>> Out of the above, jsftemplating-dt.jar, webui-jsf-dt.jar and
>>>>> javaee.jar are not part of the war file.
>>>>> Here is the error when the application is run:
>>>>>
>>>>> *exception*
>>>>>
>>>>> javax.servlet.ServletException:
>>>>> com/sun/rave/designtime/faces/FacetDescriptor
>>>>>
>>>>> *root cause*
>>>>>
>>>>> java.lang.NoClassDefFoundError:
>>>>> com/sun/rave/designtime/faces/FacetDescriptor
>>>>>
>>>>>
>>>>> -Karam