Attach all this to a jira, on the list it is getting lost On 3/25/08, Matthew Young <[EMAIL PROTECTED]> wrote: > I forgot to include the HomePage.html. Here is all the files of my small > test. Please check it out if possible. If you run it with JS off, all is > fine. With JS on, Ajax response is wrong. > > HomePage.html: > > <html> > <head></head> > <span wicket:id="message">message will be here</span> > <form wicket:id="form"> > <input type="text" wicket:id="word"/> > <input type="submit" value="Enter" wicket:id="submitButton"/> > </form> > <span wicket:id="feedback">FEEDBACK</span> > </html> > > HomePage.java: > > public class HomePage extends WebPage { > > private static final long serialVersionUID = 1L; > > private String word; > > public HomePage(final PageParameters parameters) { > > add(new FeedbackPanel("feedback") { > private static final long serialVersionUID = 1L; > @Override protected void onBeforeRender() { > System.out.println("= = = = FeedbackPanel > onBeforeRender()"); > System.out.println(" FeedbackbackMessageModel = " > + getFeedbackMessagesModel().getObject()); > super.onBeforeRender(); > } > }.setOutputMarkupPlaceholderTag(true)); > // if the word "blowup" is entered, > //this register a error message and throw > IModel model = new Model() { > private static final long serialVersionUID = 1L; > @Override public Object getObject() { > if (word != null && word.equals("blowup")) { > word = "-w-e-b-l-e-w-u-p-"; > HomePage.this.fatal("[2/2]This message is from Model."); > getPage().detach(); > System.out.println("! ! ! ! ! throwing new > AbstractRestartResponseException()"); > throw new AbstractRestartResponseException() { > private static final long serialVersionUID = 1L; > }; > } else { > return "The word is: \"" + (word == null ? " n u l l " : > word) + "\""; > } > } > }; > add(new Label("message", model) { > private static final long serialVersionUID = 1L; > @Override protected void onBeforeRender() { > System.out.println("= = = = Label onBeforeRender(), model = > " + getModel().getObject()); > super.onBeforeRender(); > } > }.setOutputMarkupId(true)); > Form form = new Form("form", new CompoundPropertyModel(this)); > add(form); > form.add(new TextField("word").setRequired(true)); > AjaxFallbackButton submitButton = new > AjaxFallbackButton("submitButton", form) { > private static final long serialVersionUID = 1L; > @Override protected void onSubmit(AjaxRequestTarget target, Form > f) { > if (word != null && word.equals("blowup")) { > HomePage.this.error("[1/2]This message is from onSubmit. > There should also be a message from model"); > } > if (target != null) { > target.addComponent(HomePage.this.get("feedback")); > // clear error feedback if any > target.addComponent(HomePage.this.get("message")); > } > } > > @Override protected void onError(AjaxRequestTarget target, Form > f) { > target.addComponent(HomePage.this.get("feedback")); > // show updated error feedback > } > }; > form.add(submitButton); > } > } > > > > WicketApplication.java: > > public class WicketApplication extends WebApplication > { > public WicketApplication() { > } > > public Class<? extends WebPage> getHomePage() { > return HomePage.class; > } > > > @Override public RequestCycle newRequestCycle(Request request, Response > response) { > return new WebRequestCycle(this, (WebRequest) request, (WebResponse) > response) { > @Override public Page onRuntimeException(Page page, > RuntimeException e) { > // page can be null > if (page == null) { > return super.onRuntimeException(page, e); > } > return page; > } > }; > } > > } >
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]