in Education by
I have a Composite Component that uses ajax to change multiple elements when an item is selected. I am also using Primefaces p:ajax and p:commandButton instead of f:ajax if that makes any difference. The problem is I cannot find the right update attribute to use on the components so that the whole component updates. For example, in the following button:

I have tried all the following and none of them work: update="@this" update="@form" update="#{cc.clientId}" update=":#{cc.clientId}" update="#{cc.clientId}:localID" update=":#{cc.clientId}:localID" The only thing that does work is this: update="#{cc.attrs.update}" and then the client page passes some clientId that includes the composite component. However I don't want to force the user to include an update parameter in the component invocation. Is there a convenient way of doing this? Update Ok I think it might help if I showed a complete test case. I implement a UINamingContainer to back the composite component like this: /* * Test code */ package com.myapp.app.component; import java.io.Serializable; import javax.faces.component.FacesComponent; import javax.faces.component.UINamingContainer; @FacesComponent(value="qctest") public class Qctest extends UINamingContainer implements Serializable { private enum StateKey { Counter } public Qctest() { } @Override public String getFamily() { return "javax.faces.NamingContainer"; } public Integer getCounter() { Integer i = (Integer) getStateHelper().get(StateKey.Counter); if (i == null) i = Integer.valueOf(1); else i += 1; getStateHelper().put(StateKey.Counter, i); return i; } } Then the cc definition looks like this: <!-- INTERFACE --> <!-- IMPLEMENTATION -->


This code is basically the OMG my first AJAX page ever! application, except it is inside a composite component instead of a regular page with normal backing bean. Neither button succeeds in doing the update. Firebug shows the XHR being sent, but the response does not update the counter. None of the different values for update or render works. In the case shown, the primefaces button seems to do nothing, in the case of the JSF command button I get a dialog box that says: malformedXML: During update: test2form:xyz not found This seems to me to be the most trivial use of AJAX inside a Composite Component. Can anyone explain what could be going on? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
malformedXML: During update: test2form:xyz not found You're right, there's no one HTML element in the generated HTML DOM tree which has exactly that ID. The composite component's content is by itself not wrapped in some generic HTML element which is reachable by JavaScript. You'd basically need to bring in some container component: ... ...

... But I still wonder why @form didn't work for you. It works for me.

Related questions

0 votes
    I'm a bit surprised I'm having trouble finding this online, but I can't seem to find an example ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I'm a bit surprised I'm having trouble finding this online, but I can't seem to find an example ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I'm a bit surprised I'm having trouble finding this online, but I can't seem to find an example ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    On the left you will notice the google logo rendered by IE, I drew a black line at the top and ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    On the left you will notice the google logo rendered by IE, I drew a black line at the top and ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    On the left you will notice the google logo rendered by IE, I drew a black line at the top and ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 10, 2022 in Education by JackTerrance
0 votes
    Hopefully this isn't too confusing. I have a main view controller (MainView) with a stackview at the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 22, 2022 in Education by JackTerrance
0 votes
    Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 13, 2022 in Education by JackTerrance
0 votes
    1. Name the term which is used to join two separate arrays into a single array. 2.How are the following ... ii) primitive type data Select the correct answer from above options...
asked Dec 13, 2021 in Education by JackTerrance
0 votes
    So I have a Nginx running inside a docker container, I have a mysql running on the host system, I ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I asked a question yesterday and none of the answers are working so I decided to start a fresh one ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 29, 2022 in Education by JackTerrance
0 votes
    In SQL Server, it's possible to insert into a table using a SELECT statement: INSERT INTO Table (col1, col2, ... .id = other_table.id Select the correct answer from above options...
asked Jan 26, 2022 in Education by JackTerrance
0 votes
    How do I update the GUI from another thread in C#?...
asked Jan 16, 2021 in Technology by JackTerrance
0 votes
    It's a sad fact of life on Scala that if you instantiate a List[Int], you can verify that your ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
...