You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by christophe <ma...@wanadoo.fr> on 2017/01/04 13:14:29 UTC

Question/Suggestion about updating a component in aw existing page (Wicket 6.x)

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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Question/Suggestion about updating a component in aw existing page (Wicket 6.x)

Posted by Martin Grigorov <mg...@apache.org>.
Hello dear writer :-)

On Wed, Jan 4, 2017 at 2:14 PM, christophe <ma...@wanadoo.fr>
wrote:

> 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
>

If you replace ComponentA with ComponentB then it is perfectly fine
If you replace ComponentA with a new instance of ComponentA then maybe you
should use a dynamic model, as Bas suggestedthe


> 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?
>

Most probably not!
1) because we (Wicket developers and users) don't like magic
2) it is hard for the framework to decide whether a Component has been
changed or not. If it is only an updated model object then Wicket is
notified, but a Component can have its own state (member fields) and
without using bytecode modification of all your classes it is impossible to
know whether something has changed. And bytecode modification is a big
magic!

In the past I have implemented such auto-added FeedbackPanel. By using
AjaxRequestTarget.IListener and FeedbackCollector#collect() I've decided
whether to add MyBasePage.getFeedbackPanel() to the target.
It worked fine but here I knew the exact rules when and what to add to the
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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Question/Suggestion about updating a component in aw existing page (Wicket 6.x)

Posted by christophe <ma...@wanadoo.fr>.
Hello Sebastian

Thanks for your confirmation (it must be “manual”).. So I was not doing the wrong thing.
I will  “extend” the components to  issue to do  both updates “automatically”. 
As to the getSession().. It is misleading as it refers to an “application session” It does not have anything to do with the http session... But I will rename it anyway as I understand that the name is very misleading.

Wicket is brillant.. Congratulations

Thank you
Christophe

From: Sebastian [via Apache Wicket] 
Sent: Wednesday, January 04, 2017 3:10 PM
To: christophe 
Subject: Re: Question/Suggestion about updating a component in aw existing page (Wicket 6.x)

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 ([hidden email]) 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: [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-tp4676637p4676641.html 
To unsubscribe from Question/Suggestion about updating a component in aw existing page (Wicket 6.x), click here.
NAML

--
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-tp4676637p4676642.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Question/Suggestion about updating a component in aw existing page (Wicket 6.x)

Posted by Martin Grigorov <mg...@apache.org>.
Small correction:

getRequest().find(AjaxRequestTarget.class)

should be

getRequestCycle().find(AjaxRequestTarget.class)

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Jan 4, 2017 at 3:26 PM, Bas Gooren <ba...@iswd.nl> wrote:

> 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.christophe@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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Question/Suggestion about updating a component in aw existing page (Wicket 6.x)

Posted by Bas Gooren <ba...@iswd.nl>.
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.christophe@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-unsubscribe@wicket.apache.org  
For additional commands, e-mail: users-help@wicket.apache.org  


Re: Question/Suggestion about updating a component in aw existing page (Wicket 6.x)

Posted by christophe <ma...@wanadoo.fr>.
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Question/Suggestion about updating a component in aw existing page (Wicket 6.x)

Posted by Bas Gooren <ba...@iswd.nl>.
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 (madeleine.christophe@wanadoo.fr) 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: users-unsubscribe@wicket.apache.org  
For additional commands, e-mail: users-help@wicket.apache.org