• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ajax within a composite component

 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use render=":client-view", or possible ":form-id:client-view", to search from the root.
 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18304
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic