| Author |
ajax within a composite component
|
nimo frey
Ranch Hand
Joined: Jun 28, 2008
Posts: 580
|
|
I have a component called "test":
and the "view.xhtml" which uses the component "test":
When rendering "view.xhtml", then I get the following error:
How can I solve that?
(Besides, when using <f:ajax render="@form" /> within the component-component all works, but I want to assign a ID to limit the rendering.)
|
 |
Brendan Healey
Ranch Hand
Joined: May 12, 2009
Posts: 218
|
|
|
Use render=":client-view", or possible ":form-id:client-view", to search from the root.
|
 |
nimo frey
Ranch Hand
Joined: Jun 28, 2008
Posts: 580
|
|
Unfortunately, ":client-view" does also not work:
<f:ajax> contains an unknown id ':client-view' - cannot locate it in the context of the component test-id.
When I look at the client-code, that the component has indeed the "client-view" as ID. (no ":my-form:client-view", as I wrapped the component with <h:form id="my-form" prependId="false">).
Why does my JSF-component not find the ID of its parent?
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14460
|
|
nimo frey wrote:
Why does my JSF-component not find the ID of its parent?
Because parameters don't understand relative paths within naming containers. Just string values. That means that you're going to have to deal with it the same way JavaScript does.
I think that if you code the following, it should work better:
However, I'm uncertain on a few things, since you didn't declare a "parent" attribute in cc:attrs. Then again, I'm not familiar with that technique anyway. I'm pretty sure last time I did something like this, I just coded things in this form:
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
nimo frey
Ranch Hand
Joined: Jun 28, 2008
Posts: 580
|
|
I added the parent-property (the string-identifier of the parent component in which my component is put):
The use of my component:
now returns the following error:
java.lang.IllegalArgumentException: java.lang.ClassCastException@2b4193b3
at sun.reflect.GeneratedMethodAccessor213.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at javax.faces.component.UIComponentBase$AttributesMap.put(UIComponentBase.java:2399)
at javax.faces.component.UIComponentBase$AttributesMap.put(UIComponentBase.java:2283)
at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler$CompositeComponentRule$LiteralAttributeMetadata.applyMetadata(CompositeComponentTagHandler.java:577)
at com.sun.faces.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:81)
|
 |
 |
|
|
subject: ajax within a composite component
|
|
|