khaliq/Nusa,
I am also getting the cast exception. I was able to create a regular JSF managed bean and
bind/cast to it just fine however, binding to a Seam component caused the cast exception:
Caused by: java.lang.ClassCastException:
org.apache.myfaces.trinidad.component.core.data.CoreTable cannot be cast to
org.apache.myfaces.trinidad.component.core.data.CoreTable
I can only speculate at this point, but I assume it's something to do with AOP
mechanisms changing something about the class during the binding process. Generally in
Seam one would be injecting classes based on interfaces or entity beans rather than
'raw' object instance. I would appreciate it if someone could explain what's
going on here or direct me to some further reading.
The reason I was binding the table to the Seam component was to get a handle on the
component before render response so that I could initialise row selection for the
<tr:table ... rowSelection="single"> mode. This requires direct access to
the component instance after it has been bound to its data. From what I can tell, my
efforts were in vein due to the life cycle of Facelets:
* BEFORE_RENDER_RESPONSE event fired;
* facelets build process starts, binding to my seam component occurs;
* getter is called for the component;
* data model factory is called;
* AFTER_RENDER_RESPONSE event fired;
Basically, the last possible hook into this process (that I could find) was with the
getter for the component or even the data model factory (yuk!). Since the actual data
model binding occurs after this, there is nothing that I can use to set the selected row
keys.
As a general comment, I have been able to do this sort of processing easily under the Java
Studio Creator 2 application model using the prerender() method on my backing beans. This
is essentially a hook invoked during the BEFORE_RENDER_RESPONSE phase. With this in mind,
I tried experimenting with Seam "org.jboss.seam.beforePhase" event but this is
fired before facelets even starts building its tree. I understand that the JSC2 approach
and the facelets approach are very different, but it does seem odd that there is no way to
get at the underlying JSF components before they are rendered. I assume that facelets tree
is built during this phase? Or perhaps (probably) I'm missing something, but I have
searched for the best part of a day on this and not come across anything.
C.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3990788#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...