• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

ajax within a composite component

 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.)

 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Saloon Keeper
Posts: 25653
183
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic