after a form submit the url is changed to point to the instance of the home page that is now in session, that is why the updates to the random label stopped.
-Igor
On 2/1/06, Daniel Rocco <[EMAIL PROTECTED]> wrote:
hi folks,
I'm trying to understand how and when pages get updated and am a little
bit confused about the difference between the "static" and "dynamic"
model updates. Starting from the QuickStart application, I've created a
simple page with a text box and a label. The text box is bound to a
property in an object, and clicking the submit button updates the
property and redisplays the current page (with the new text box value).
The label is tied to another object property that simply returns a
random float:
add(new Label("randomFloat", Float.toString(random.getRandomFloat())));
When the page is first loaded, everything looks fine: the text box
displays the and the label displays its random float. Unexpectedly,
reloading the page causes the label to update its value (I thought the
above code created a static model that wouldn't be updated after the
initial page construction). Even stranger, submitting the form causes
the label updates to stop: subsequent refreshes redisplay the label
value shown when the submit button was clicked. This second behavior is
actually what I expected to happen: after initial page construction, I
expected the label's value to stay constant. I'm confused about 1) why
the label updates initially, and 2) what submitting the form does to
alter this initial behavior.
Incidentally, using a PropertyModel results in the expected behavior.
Replacing the above code with:
add(new Label("randomFloat", new PropertyModel (random,
"randomFloat")));
causes the label to display a new value on page refresh both before and
after submitting the form.
sorry if this question has an obvious answer that I have overlooked, but
I have not been able to tease it out of the documentation or mailing
list archives.
Wicket is fantastic: I love the separation of HTML and Java and the
emphasis on simplicity. Keep up the great work!
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
