开发者

Wicket - SetResponsePage callback not firing

开发者 https://www.devze.com 2023-03-17 15:49 出处:网络
I\'m writing my first wicket app , and ran into my first road-block today . Here\'s the problem . I have a page which contains an AjaxSubmitLink . In it\'s onSubmit event , I load a panel using setRes

I'm writing my first wicket app , and ran into my first road-block today . Here's the problem . I have a page which contains an AjaxSubmitLink . In it's onSubmit event , I load a panel using setResponsePage .

From the homepage of my app , I can navigate to the above mentioned page in 2 ways - either by a hyperlink or by switching a tab (use a basic ITab from wicket-extensions), both of which invokes the same constructor with identical arguments.

Now if I navigate to the page using the hyperlink , everything works fine . However , if I u开发者_C百科se the tab to navigate to the page , the AjaxSubmitLink doesnt load the panel . There's an Ajax request being made , I can see the server processing it , but it's like no callback is being executed .

Another strange thing I noticed , in the latter case , firebug doesn't log my Ajax requests on the console . It logs requests in the former case just fine .

I'm kinda stumped here , any hints,pointers or nudges ?

Edit : Code declaring the link .

 editLink = new AjaxSubmitLink("editLink") {
            @Override
            protected void onSubmit(AjaxRequestTarget target, Form<?> masterForm) {
                    setResponsePage(new EditPage(programId));
            }
        };

Edit : I inspected the requests made with fiddler , the unsuccessful Ajax calls are returning a 302 , instead of 200.

UPDATE :

I kinda found a workaround . The fiddler information lead me to search for the setResponsePage behaviour , which lead me to https://issues.apache.org/jira/browse/WICKET-1703 .

Anyway since I didnt strictly need a POST request for the link , used a GET instead to get the desired behaviour .

Interesting find using fiddler : the content-type of the request sent is multipart/form-data rather than application/x-www-form-urlencoded in the erroneous case.

I'm still kind of in the dark on the actual issue , appreciate any explanations .


setResponsePage() should get a .class file or a instantiated class instead. like

NextPage np = new NextPage(int a,int b);
....
setResponsePage(np);

or

setResponsePage(NextPage.class);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号