Hi! Yes, wicket does not automatically add changed components to the ajax response. That would be a lot of magic, which does not fit with the way the rest of the framework works (for as far as I know). I quite like how it currently works, as it’s very clear what happens.
Looking at your code, I have some tips: Don’t store the AjaxRequestTarget (ART) in the session. The session can exist across requests, so this is not something you want to mix. You can always get the current ART from inside a component in case you don’t have a reference to it: getRequest().find(AjaxRequestTarget.class) Making things more “automatic” for your specific application: There is a number of ways to do this; One example would be to create a custom component which does what you want, which either extends existing wicket components or wraps them (e.g. a Panel). Another example would be to broadcast a wicket event from every component once it’s been updated (storing a component reference in the event); You can then listen for these events in your “parent”/owning component and add the component to the ART. Met vriendelijke groet, Kind regards, Bas Gooren Op 4 januari 2017 bij 15:10:46, christophe (madeleine.christo...@wanadoo.fr) schreef: Hello Sebastian That was a fast feedback!! I am impressed!!! For 2) I would have to go and modify the code to get you the exact error. What I was trying to point out was simply that if Ido not BOTH replace or update the component (its state, its content) AND add to to The AjaxRequestTarget ( target.add(myComponent) I get all sorts of malfunction. So the question was really is this how it mut be done or am I missing something important (after several years of Wicket programming, there would not be much to be proud about!!) This is an example (simplifed) to update the content of a text input field public void setValue(String value) { // Some business logic //Then model = new Model<String>(value); field.setModel(model);// Does not add the field to the output stream if (getSession().getTarget() ) // If an Ajax event is being processed the Target it came with is stored for the duration of said “process” getSession().getTarget().add(field); //If I dont do this the content does not get updated on the browser } So my understanding is that, in the context of an event (intercepted by a behavior) that comes “bundled” with an AjaxRequestTarget updating the component (and possibly replacing it) is not enough for said component to be added to the output stream. I must manuall do it via AjaxRequestTarget#add(Component). Hence my 2 questions: I am right? What about mking this “automatic”? If I am wrong please let me know Regards Christopeh From: Sebastian [via Apache Wicket] Sent: Wednesday, January 04, 2017 2:28 PM To: christophe Subject: Re: Question/Suggestion about updating a component in aw existing page (Wicket 6.x) Hi Christophe! Regarding (1): it sounds like you are not using models properly; Models are what makes a component “dynamic” - they pull data from a source (which could be a static string). Can you show us some code? Regarding (2): Can you show us the exceptions you get? In any case you should be aware that you cannot re-render a hidden component, unless you set its setOutputMarkupPlaceholderTag(true) method, ensuring that there is always a HTML element to replace. Another common solution is to re-render a container element which is always present in the HTML. Met vriendelijke groet, Kind regards, Bas Gooren Op 4 januari 2017 bij 14:33:34, christophe ([hidden email]) schreef: Hello dear readers I am working on a web application that is very very AJAX-oriented. In other words any "displayed" page gets updated many times as a consequence of events such as (html) blur, mouse click. By updating I mean One or more fields become visible or invisible One or more fields become enabled or disabled Their content (for example a drop down list) changes Many more To actually "change" a markup component I 1) create a new one and replace the existing one or udpate the Component (for example to enable it) 2) Add this component to the AjaxRequestTarget I must do both because if I do 1 only: the change is not reflected in the web page. 2 only the component is not in the right "state" and I get all sorts of exceptions when it receives a message So I was wondering 1) AM i doing this right or amm I missing the obvious 2) If I am not doing anything wrong would it be possible to "enhance" Wicket so that any replace or "state", content update gets added "automatically" to the Request Target? I sincerely hope to hear from someone. Christophe -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Question-Suggestion-about-updating-a-component-in-aw-existing-page-Wicket-6-x-tp4676637.html Sent from the Users forum mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] -------------------------------------------------------------------------------- If you reply to this email, your message will be added to the discussion below: http://apache-wicket.1842946.n4.nabble.com/Question-Suggestion-about-updating-a-component-in-aw-existing-page-Wicket-6-x-tp4676637p4676638.html To unsubscribe from Question/Suggestion about updating a component in aw existing page (Wicket 6.x), click here. NAML wlEmoticon-smile[1].png (1K) <http://apache-wicket.1842946.n4.nabble.com/attachment/4676639/0/wlEmoticon-smile%5B1%5D.png> -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Question-Suggestion-about-updating-a-component-in-aw-existing-page-Wicket-6-x-tp4676637p4676639.html Sent from the Users forum mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org