aspose file tools*
The moose likes JSF and the fly likes How to display dynamic columns in h:dataTable ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "How to display dynamic columns in h:dataTable ?" Watch "How to display dynamic columns in h:dataTable ?" New topic
Author

How to display dynamic columns in h:dataTable ?

Arun Kandregula
Greenhorn

Joined: Dec 19, 2005
Posts: 26
May I know how to display dynamic columsn in dataTabel.

I tried with Rich Faces.



Here is the problem : I didnt find a solution to display dynamic columns in standard JSF. So I resorted to richfaces.
But there, with the above tag, it is not recognizing the local variable priceTypeRow.

It throws below exception :

EV 14:22:52 ERROR ColumnsHandler - FOREACH_BAD_ITEMS
avax.servlet.jsp.JspTagException: FOREACH_BAD_ITEMS
at org.richfaces.iterator.SimpleForEachIterator.toForEachIterator(Simple
orEachIterator.java:135)
at org.richfaces.iterator.SimpleForEachIterator.supportedTypeForEachIter
tor(SimpleForEachIterator.java:98)
at org.richfaces.taglib.ColumnsHandler.prepare(ColumnsHandler.java:304)
at org.richfaces.taglib.ColumnsHandler.apply(ColumnsHandler.java:489)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentH
ndler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java
169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHa
dler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentH
ndler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java
169)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentH
ndler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java
169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHa
dler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentH
ndler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java
169)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentH
ndler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java
169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHa
dler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentH
ndler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java
169)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentH
ndler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java
169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHa
dler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentH
ndler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java
169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHa
dler.java:47)
at com.sun.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:109)

at com.sun.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.j
va:64)
at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.j
va:131)
at com.sun.facelets.impl.DefaultFaceletContext$TemplateManager.apply(Def
ultFaceletContext.java:310)
at com.sun.facelets.impl.DefaultFaceletContext.includeDefinition(Default
aceletContext.java:280)
at com.sun.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:68)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHa
dler.java:47)
at com.sun.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.j
va:64)
at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.j
va:131)
at com.sun.facelets.impl.DefaultFaceletContext$TemplateManager.apply(Def
ultFaceletContext.java:310)
at com.sun.facelets.impl.DefaultFaceletContext.includeDefinition(Default
aceletContext.java:280)
at com.sun.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:68)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHa
dler.java:47)
at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.jav
:49)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHa
dler.java:47)
at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:
5)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)

Thanks.
Arun Kumar Kandregula.
SCBCD 1.3 92%
SCJP 1.4 98%
Arun Kandregula
Greenhorn

Joined: Dec 19, 2005
Posts: 26
This is my finding till now:

I can access the variable in side

// CODE with problem...


So I defined similar column collection in someCollection itself and i am able to access the columns like this :

//CODE with imperfect solution (working)




 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to display dynamic columns in h:dataTable ?