Thanks, Sven - I'll take a look at your examples and try to diff against what we're doing.
Until then, I've been able to reduce this down to a relatively simple example, which you can see in action at: http://1.wp-portal-staging.appspot.com/portal/pages/Test Pressing the "deactivate" button clears a model value via Ajax and you see the change on the page. But when the Save_changes button is pressed, the model has been reverted and an error is displayed ("FAIL..."). This works correctly (showing "Yay...") when I run it locally with the AppEngine SDK. I feel like I must be doing something really stupid, but I can't see it, even in this simple example. Below are the Java and HTML sources. I've taken our original page and stripped out everything not relevant, including the dependencies on base classes we use for all pages. However, it still depends the same application code. My next step is to start paring that down. Thanks for looking! Chris BTW, AppEngine SDK 1.9.6, Wicket 6.19.0 and Java 1.7.0_67. package com.webperformance.portal.pages; import com.webperfcenter.util.*; import org.apache.wicket.ajax.*; import org.apache.wicket.ajax.markup.html.form.*; import org.apache.wicket.markup.html.*; import org.apache.wicket.markup.html.basic.*; import org.apache.wicket.markup.html.form.*; import org.apache.wicket.markup.html.panel.*; import org.apache.wicket.model.*; /** * @author Web Performance Inc, Copyright 2010 */ public class TestPage extends WebPage { public TestPage() { Form form = new Form("form"); add(form); // // activation fields // activation_user_label = new Label("activation_user", _activation_user); activation_user_label.setOutputMarkupId(true); form.add(activation_user_label); Button deactivate_button = new AjaxButton("deactivate_button") { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { System.out.println("deactivating."); _activation_user.setObject(null); target.add(activation_user_label); } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { } private static final long serialVersionUID = 2538399692982064089L; }; form.add(deactivate_button); deactivate_button.add(new Label("deactivate_button_label", new ResourceModel("Deactivate"))); // submit button Button submit_button = new Button("submit_button") { @Override @SuppressWarnings("deprecation") // we still have to deal with old privileges public void onSubmit() { Debug.log.out("_activation_user=" + _activation_user.getObject()); if (_activation_user.getObject() == null) error("YAY! _activation_user is null"); else error("FAIL! If you pressed the Deactivate button, then _activation_user should have been null. Instead it is: " + _activation_user.getObject()); } }; submit_button.add(new Label("submit_button_label", "Save_Changes")); form.add(submit_button); FeedbackPanel feedback_panel = new FeedbackPanel("feedback"); feedback_panel.setOutputMarkupId(true); form.add(feedback_panel); } private Model<String> _activation_user = new Model<String>("Bob"); private Label activation_user_label; } <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.sourceforge.net/"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>application title</title> </head> <body> <form action="#" wicket:id="form"> <h2><wicket:message key="Activation">activate status</wicket:message></h2> <table cellspacing="0" class="dataview"> <tr> <th><wicket:message key="Activation_user">activated by</wicket:message></th> <td colspan="2"><span wicket:id="activation_user">joe user</span></td> </tr> <tr> <td><button wicket:id="deactivate_button"><span wicket:id="deactivate_button_label">renew</span></button></td> </tr> </table> <div> <button wicket:id="submit_button" type="submit" class="button"><span wicket:id="submit_button_label">save it</span></button> </div> <p wicket:id="feedback"></p> </form> </body> </html> On Wed, May 13, 2015 at 4:40 PM, Sven Meier <[email protected]> wrote: > Hi, > > I have a small example application running on AppEngine and I didn't > encounter any of your problems: > > http://wicket-dnd-jquery.appspot.com > > Perhaps you can check the code for any differences between your setup and > mine: > > https://github.com/svenmeier/wicket-dnd/tree/master/wicket-dnd-examples > > If it helps, I could take a look at your application: source code and/or > the running application on AppEngine - you can send me details via PM. > > Have fun > Sven > > > > On 13.05.2015 20:56, Christopher Merrill wrote: > >> I have an AjaxButton that nulls a model value like this: >> >> Button deactivate_button = new AjaxButton("deactivate_button") >> { >> @Override >> protected void onSubmit(AjaxRequestTarget target, Form<?> >> form) >> { >> System.out.println("deactivating."); >> _activation_user.setObject(null); >> target.add(activation_user_label); >> } >> ... >> private Model<String> _activation_user = new Model<String>(); >> >> The println statement appears in the logs, so I know this code is being >> called. (the activation_user_label displays _activation_user). >> >> But then in the form's onSubmit() method, the value of the >> _activation_user >> model is reverted to the original value - i.e. it is not null as it should >> be. I also observe this via a println(). >> >> Here's the part that has me very puzzled - this is code that has been >> working for more than a year - the problem started when we upgraded to >> Wicket 6. It works fine in my development environment. It does not work >> when deployed to AppEngine. This issue is a subset of the problems I >> mentioned in a previous post (Google AppEngine Initializer and Wicket 6). >> I >> decided to pick one of the problems and try to dig as deep as I could into >> it. Unfortunately, debugging it has been frustrating since I can't >> reproduce it locally...I've been reduced to system.out.println()s :( >> >> There is only one form on the page and virtually the entire page is in it, >> including the AjaxButton referenced above. I have a similar problem on >> another page where an Ajax event listener is enabling a button, but >> pressing the button results in a Wicket error complaining that the button >> is not enabled. In both cases, it appears that the state of the page has >> been "reset" to it's previous state after the ajax event is done...or that >> the second form submission is directed at the previous copy of the page >> state, rather than the post-ajax submission state. Does that make any >> sense >> to anyone? I understand there were a lot of changes with Ajax handling in >> Wicket 5-6 and I'm not at all confident that I have made all the necessary >> code changes on our end to adapt to that (though I seem to recall reading >> that those changes should be minimal). Is there anything in the Wicket >> environment that we may have customized back in the Wicket 4 days for >> AppEngine that might induce this type of behavior? Something related to >> how >> Wicket stores/retrieves page state? >> >> I'm grasping at straws here, especially without the ability to step into >> the Wicket code:( Any advice is greatly appreciated! >> >> I think my next direction is going to be to attempt to code a page from >> scratch that exhibits this behavior...that should, at the least, make for >> an easier example to show. If anyone has any better ideas... >> >> TIA! >> Chris >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
