You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Jan Loose <ja...@cleverlance.com> on 2011/11/24 10:08:33 UTC

two pages submit problem

Hello,

we are using Wicket 1.4.18 and we found a problem if we open two pages  
then the AjaxLink works great but the AjaxSubmitLink doesn't. The page is  
mounted by HybridUrlCodingStrategy, but I've tried the normal bookmarkable  
mount and the behavior is the same. I've created a simple page, that  
demonstrates the problem.

public class TestPage extends WebPage {

     private String input;

     public TestPage() {
         Form<Void> form;
         add(form = new Form<Void>("form"));

         final TextField<String> inputField = new  
TextField<String>("input", new PropertyModel<String>(this, "input"));
         form.add(inputField.setOutputMarkupId(true));

         form.add(new AjaxSubmitLink("submit") {

             @Override
             protected void onSubmit(AjaxRequestTarget target, Form<?>  
form) {
                 input = "submit " + Math.random();
                 target.addComponent(inputField);
             }
         });
         form.add(new AjaxLink<Void>("link") {

             @Override
             public void onClick(AjaxRequestTarget target) {
                 input = "link " + Math.random();
                 target.addComponent(inputField);
             }
         });
     }

     public String getInput() {
         return input;
     }

     public void setInput(String input) {
         this.input = input;
     }
}

<?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.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<head>
     <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
     <title>TestPage</title>
</head>
<body>
     <form wicket:id="form">
         <div>
             <input wicket:id="input"/>
             <a wicket:id="submit">submit</a>
             <a wicket:id="link">link</a>
         </div>
     </form>
</body>
</html>

Just open the page in two tabs in one browser (I've tested it in Opera and  
Chrome). In the first tab click to the submit link (AjaxSubmitLink) and  
then switch to the second page and click to the submit link too. Nothing  
happened. I investigated there is used EmptyAjaxRequestTarget, but I'm not  
sure why, because if try the same scenario using the second link  
(AjaxLink) then it works fine.

Where is the problem? What am I doing wrong? How can I solve this problem?

Best regards,
Jan

Re: two pages submit problem

Posted by Dan Retzlaff <dr...@gmail.com>.
Ideas:

1. Instead of using AjaxSubmitLink, you can attach an
AjaxFormSubmitBehavior subclass that overrides getCallbackUrl() to call
getCallbackUrl(false) instead of getCallbackUrl(true).

2. Override WebApplication#newRequestCycleProcessor to return a custom
processor that overrides WebRequestCycleProcessor#resolve that calls
requestParameters.setOnlyProcessIfPathActive(false) before super.resolve().

On Wed, Nov 30, 2011 at 12:36 AM, Jan Loose <ja...@cleverlance.com>wrote:

> **
> Hi Dan,
>
> thx for you answer. I have a problem, because we are not able to migrate
> to 1.5, because our project is very large and in phase of testing, so now
> it is impossible to migrate and no matter how much I want it. We don't want
> to use disk as a storage, so what can we do?
>
> I've tried that if the submit is broken the link still works and when I
> click to it, then it fixes submit and it works then for both tabs. My only
> wish is to work it always:-)
>
> What can I do, what can I fix in AccessStackPageMap? I can extend it or
> copy it and change it, but it is a little complicated, so I would
> appreciate help.
>
> Jan
>
>
> On Wed, 30 Nov 2011 06:29:32 +0100, Dan Retzlaff <dr...@gmail.com>
> wrote:
>
> Jan,
>
> The submits for the first page are being ignored because the behavior on
> the AjaxSubmitLink that submits the form is configured to only target the
> active page. You can see this in AbstractAjaxBehavior#getCallbackUrl()
> during page construction. However, the ignore logic is only implemented for
> AccessStackPageMap (used by HttpSessionStore) and not
> SecondLevelCachePageMap (used by the default SecondLevelCacheSessionStore).
> With the default session store, execution literally falls through a "//
> TODO also this should work.." in WebRequestCycleProcessor and the request
> is handled.
>
> Don't hold your breath for a solution in 1.4. As you've probably inferred
> from the clamor to answer your question, the community has largely moved on
> to 1.5. By the way, all of this "target active page only" business has
> apparently been removed there.
>
> I hope that at least helps remove some confusion. :)
>
> Dan
>
> On Mon, Nov 28, 2011 at 3:15 AM, Jan Loose <ja...@cleverlance.com>wrote:
>
>> Hi,
>>
>> I investigated a little bit and I found that it happened only for
>> HttpSessionStore:
>>
>> This is my test application:
>>
>> public class TestApplication extends WebApplication {
>>
>>    @Override
>>    public Class<? extends Page> getHomePage() {
>>        return TestPage.class;
>>    }
>>
>>    @Override
>>    protected void init() {
>>        super.init();
>>        mount(new HybridUrlCodingStrategy("/test", TestPage.class));
>>    }
>>
>>    @Override
>>    protected ISessionStore newSessionStore() {
>>        return new HttpSessionStore(this);
>>    }
>> }
>>
>> The whole application is here: http://web.loose.cz/wicket/test.zip(maven + war)
>>
>> It is broken for Apache Tomcat 7 (Development) and for IBM WebSphere
>> (Production) too, so it is not problem of one application server.
>>
>> The steps needed to reproduction:
>> 1. open browser
>> 2. go to http://localhost:8080/test-1.0/test
>> 3. open new tab
>> 4. go to http://localhost:8080/test-1.0/test
>> 5. click to submit
>> 6. swicth to first tab
>> 7. click to submit -> nothing happened
>> 8. click to link -> it works
>> 9. click to submit -> now it works too
>> 10. go to second tab -> submit/link work fine
>>
>> Br,
>> Jan
>>
>>
>>
>> On Thu, 24 Nov 2011 16:50:37 +0100, Dan Retzlaff <dr...@gmail.com>
>> wrote:
>>
>>  Hi, Jan. Your code looks okay to me. I tested in Chrome myself using
>>> 1.4.18
>>> and 1.4.19 and was not able to reproduce your problem.
>>>
>>> On Thu, Nov 24, 2011 at 1:08 AM, Jan Loose <jan.loose@cleverlance.com
>>> >wrote:
>>>
>>>  Hello,
>>>>
>>>> we are using Wicket 1.4.18 and we found a problem if we open two pages
>>>> then the AjaxLink works great but the AjaxSubmitLink doesn't. The page
>>>> is
>>>> mounted by HybridUrlCodingStrategy, but I've tried the normal
>>>> bookmarkable
>>>> mount and the behavior is the same. I've created a simple page, that
>>>> demonstrates the problem.
>>>>
>>>> public class TestPage extends WebPage {
>>>>
>>>>   private String input;
>>>>
>>>>   public TestPage() {
>>>>       Form<Void> form;
>>>>       add(form = new Form<Void>("form"));
>>>>
>>>>       final TextField<String> inputField = new
>>>> TextField<String>("input",
>>>> new PropertyModel<String>(this, "input"));
>>>>       form.add(inputField.**setOutputMarkupId(true));
>>>>
>>>>
>>>>       form.add(new AjaxSubmitLink("submit") {
>>>>
>>>>           @Override
>>>>           protected void onSubmit(AjaxRequestTarget target, Form<?>
>>>> form)
>>>> {
>>>>               input = "submit " + Math.random();
>>>>               target.addComponent(**inputField);
>>>>
>>>>           }
>>>>       });
>>>>       form.add(new AjaxLink<Void>("link") {
>>>>
>>>>           @Override
>>>>           public void onClick(AjaxRequestTarget target) {
>>>>               input = "link " + Math.random();
>>>>               target.addComponent(**inputField);
>>>>
>>>>           }
>>>>       });
>>>>   }
>>>>
>>>>   public String getInput() {
>>>>       return input;
>>>>   }
>>>>
>>>>   public void setInput(String input) {
>>>>       this.input = input;
>>>>   }
>>>> }
>>>>
>>>> <?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<
>>>> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
>>>> ">
>>>> <html xmlns="http://www.w3.org/1999/**xhtml <
>>>> http://www.w3.org/1999/xhtml>"
>>>> xmlns:wicket="http://wicket.**apache.org/dtds.data/wicket-**
>>>> xhtml1.4-strict.dtd<
>>>> http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd>
>>>>
>>>> ">
>>>> <head>
>>>>   <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
>>>>   <title>TestPage</title>
>>>> </head>
>>>> <body>
>>>>   <form wicket:id="form">
>>>>       <div>
>>>>           <input wicket:id="input"/>
>>>>           <a wicket:id="submit">submit</a>
>>>>           <a wicket:id="link">link</a>
>>>>       </div>
>>>>   </form>
>>>> </body>
>>>> </html>
>>>>
>>>> Just open the page in two tabs in one browser (I've tested it in Opera
>>>> and
>>>> Chrome). In the first tab click to the submit link (AjaxSubmitLink) and
>>>> then switch to the second page and click to the submit link too. Nothing
>>>> happened. I investigated there is used EmptyAjaxRequestTarget, but I'm
>>>> not
>>>> sure why, because if try the same scenario using the second link
>>>> (AjaxLink)
>>>> then it works fine.
>>>>
>>>> Where is the problem? What am I doing wrong? How can I solve this
>>>> problem?
>>>>
>>>> Best regards,
>>>> Jan
>>>>
>>>>
>>
>> --
>> Jan Loose
>> J2EE Team Leader / Senior J2EE Developer
>> _____________________________________________
>> Cleverlance - CREATE IT
>> člen Cleverlance Group
>> www.cleverlance.com
>>
>> Dukelských hrdinů 34
>> 170 00 Praha 7
>> Czech Republic
>>
>> Tel: +420 266 177 166
>> Mobil: +420 777 788 078
>>
>
>
>
>
> --
> *Jan Loose*
> *J2EE Team Leader / Senior J2EE Developer*
> _____________________________________________
> *Cleverlance - CREATE IT*
> člen Cleverlance Group
> www.cleverlance.com
>
> Dukelských hrdinů 34
> 170 00 Praha 7
> Czech Republic
>
> Tel: +420 266 177 166
> Mobil: +420 777 788 078
>

Re: two pages submit problem

Posted by Jan Loose <ja...@cleverlance.com>.
Hi Dan,

thx for you answer. I have a problem, because we are not able to migrate  
to 1.5, because our project is very large and in phase of testing, so now  
it is impossible to migrate and no matter how much I want it. We don't  
want to use disk as a storage, so what can we do?

I've tried that if the submit is broken the link still works and when I  
click to it, then it fixes submit and it works then for both tabs. My only  
wish is to work it always:-)

What can I do, what can I fix in AccessStackPageMap? I can extend it or  
copy it and change it, but it is a little complicated, so I would  
appreciate help.

Jan


On Wed, 30 Nov 2011 06:29:32 +0100, Dan Retzlaff <dr...@gmail.com>  
wrote:

> Jan,
>
> The submits for the first page are being ignored because the behavior on  
> the AjaxSubmitLink that submits the form is configured to only target  
> the active page. You can see this in  
> >AbstractAjaxBehavior#getCallbackUrl() during page construction.  
> However, the ignore logic is only implemented for AccessStackPageMap  
> (used by HttpSessionStore) and not SecondLevelCachePageMap >(used by the  
> default SecondLevelCacheSessionStore). With the default session store,  
> execution literally falls through a "// TODO also this should work.." in  
> WebRequestCycleProcessor and the request is >handled.
>
> Don't hold your breath for a solution in 1.4. As you've probably  
> inferred from the clamor to answer your question, the community has  
> largely moved on to 1.5. By the way, all of this "target active page  
> only" >business has apparently been removed there.
>
> I hope that at least helps remove some confusion. :)
>
> Dan
>
> On Mon, Nov 28, 2011 at 3:15 AM, Jan Loose <ja...@cleverlance.com>  
> wrote:
>> Hi,
>>
>> I investigated a little bit and I found that it happened only for  
>> HttpSessionStore:
>>
>> This is my test application:
>>
>> public class TestApplication extends WebApplication {
>>
>>   @Override
>>   public Class<? extends Page> getHomePage() {
>>       return TestPage.class;
>>   }
>>
>>   @Override
>>   protected void init() {
>>       super.init();
>>       mount(new HybridUrlCodingStrategy("/test", TestPage.class));
>>   }
>>
>>   @Override
>>   protected ISessionStore newSessionStore() {
>>       return new HttpSessionStore(this);
>>   }
>> }
>>
>> The whole application is here: http://web.loose.cz/wicket/test.zip  
>> (maven + war)
>>
>> It is broken for Apache Tomcat 7 (Development) and for IBM WebSphere  
>> (Production) too, so it is not problem of one application server.
>>
>> The steps needed to reproduction:
>> 1. open browser
>> 2. go to http://localhost:8080/test-1.0/test
>> 3. open new tab
>> 4. go to http://localhost:8080/test-1.0/test
>> 5. click to submit
>> 6. swicth to first tab
>> 7. click to submit -> nothing happened
>> 8. click to link -> it works
>> 9. click to submit -> now it works too
>> 10. go to second tab -> submit/link work fine
>>
>> Br,
>> Jan
>>
>>
>>
>> On Thu, 24 Nov 2011 16:50:37 +0100, Dan Retzlaff <dr...@gmail.com>  
>> wrote:
>>
>>> Hi, Jan. Your code looks okay to me. I tested in Chrome myself using  
>>> 1.4.18
>>> and 1.4.19 and was not able to reproduce your problem.
>>>
>>> On Thu, Nov 24, 2011 at 1:08 AM, Jan Loose  
>>> <ja...@cleverlance.com>wrote:
>>>
>>>> Hello,
>>>>
>>>> we are using Wicket 1.4.18 and we found a problem if we open two pages
>>>> then the AjaxLink works great but the AjaxSubmitLink doesn't. The  
>>>> page is
>>>> mounted by HybridUrlCodingStrategy, but I've tried the normal  
>>>> bookmarkable
>>>> mount and the behavior is the same. I've created a simple page, that
>>>> demonstrates the problem.
>>>>
>>>> public class TestPage extends WebPage {
>>>>
>>>>  private String input;
>>>>
>>>>  public TestPage() {
>>>>      Form<Void> form;
>>>>      add(form = new Form<Void>("form"));
>>>>
>>>>      final TextField<String> inputField = new  
>>>> TextField<String>("input",
>>>> new PropertyModel<String>(this, "input"));
>>>>      form.add(inputField.**setOutputMarkupId(true));
>>>>
>>>>
>>>>      form.add(new AjaxSubmitLink("submit") {
>>>>
>>>>          @Override
>>>>          protected void onSubmit(AjaxRequestTarget target, Form<?>  
>>>> form)
>>>> {
>>>>              input = "submit " + Math.random();
>>>>              target.addComponent(**inputField);
>>>>
>>>>          }
>>>>      });
>>>>      form.add(new AjaxLink<Void>("link") {
>>>>
>>>>          @Override
>>>>          public void onClick(AjaxRequestTarget target) {
>>>>              input = "link " + Math.random();
>>>>              target.addComponent(**inputField);
>>>>
>>>>          }
>>>>      });
>>>>  }
>>>>
>>>>  public String getInput() {
>>>>      return input;
>>>>  }
>>>>
>>>>  public void setInput(String input) {
>>>>      this.input = input;
>>>>  }
>>>> }
>>>>
>>>> <?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<http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
>>>> ">
>>>> <html xmlns="http://www.w3.org/1999/**xhtml  
>>>> <http://www.w3.org/1999/xhtml>"
>>>> xmlns:wicket="http://wicket.**apache.org/dtds.data/wicket-**
>>>> xhtml1.4-strict.dtd<http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd>
>>>>
>>>> ">
>>>> <head>
>>>>  <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
>>>>  <title>TestPage</title>
>>>> </head>
>>>> <body>
>>>>  <form wicket:id="form">
>>>>      <div>
>>>>          <input wicket:id="input"/>
>>>>          <a wicket:id="submit">submit</a>
>>>>          <a wicket:id="link">link</a>
>>>>      </div>
>>>>  </form>
>>>> </body>
>>>> </html>
>>>>
>>>> Just open the page in two tabs in one browser (I've tested it in  
>>>> Opera and
>>>> Chrome). In the first tab click to the submit link (AjaxSubmitLink)  
>>>> and
>>>> then switch to the second page and click to the submit link too.  
>>>> Nothing
>>>> happened. I investigated there is used EmptyAjaxRequestTarget, but  
>>>> I'm not
>>>> sure why, because if try the same scenario using the second link  
>>>> (AjaxLink)
>>>> then it works fine.
>>>>
>>>> Where is the problem? What am I doing wrong? How can I solve this  
>>>> problem?
>>>>
>>>> Best regards,
>>>> Jan
>>>>
>>
>>
>> --Jan Loose
>> J2EE Team Leader / Senior J2EE Developer
>> _____________________________________________
>> Cleverlance – CREATE IT
>> člen Cleverlance Group
>> www.cleverlance.com
>>
>> Dukelských hrdinů 34
>> 170 00 Praha 7
>> Czech Republic
>>
>> Tel: +420 266 177 166
>> Mobil: +420 777 788 078
>



-- 
Jan Loose
J2EE Team Leader / Senior J2EE Developer
_____________________________________________
Cleverlance – CREATE IT
člen Cleverlance Group
www.cleverlance.com

Dukelských hrdinů 34
170 00 Praha 7
Czech Republic

Tel: +420 266 177 166
Mobil: +420 777 788 078

Re: two pages submit problem

Posted by Dan Retzlaff <dr...@gmail.com>.
Jan,

The submits for the first page are being ignored because the behavior on
the AjaxSubmitLink that submits the form is configured to only target the
active page. You can see this in AbstractAjaxBehavior#getCallbackUrl()
during page construction. However, the ignore logic is only implemented for
AccessStackPageMap (used by HttpSessionStore) and not
SecondLevelCachePageMap (used by the default SecondLevelCacheSessionStore).
With the default session store, execution literally falls through a "//
TODO also this should work.." in WebRequestCycleProcessor and the request
is handled.

Don't hold your breath for a solution in 1.4. As you've probably inferred
from the clamor to answer your question, the community has largely moved on
to 1.5. By the way, all of this "target active page only" business has
apparently been removed there.

I hope that at least helps remove some confusion. :)

Dan

On Mon, Nov 28, 2011 at 3:15 AM, Jan Loose <ja...@cleverlance.com>wrote:

> Hi,
>
> I investigated a little bit and I found that it happened only for
> HttpSessionStore:
>
> This is my test application:
>
> public class TestApplication extends WebApplication {
>
>    @Override
>    public Class<? extends Page> getHomePage() {
>        return TestPage.class;
>    }
>
>    @Override
>    protected void init() {
>        super.init();
>        mount(new HybridUrlCodingStrategy("/**test", TestPage.class));
>    }
>
>    @Override
>    protected ISessionStore newSessionStore() {
>        return new HttpSessionStore(this);
>    }
> }
>
> The whole application is here: http://web.loose.cz/wicket/**test.zip<http://web.loose.cz/wicket/test.zip>(maven + war)
>
> It is broken for Apache Tomcat 7 (Development) and for IBM WebSphere
> (Production) too, so it is not problem of one application server.
>
> The steps needed to reproduction:
> 1. open browser
> 2. go to http://localhost:8080/test-1.**0/test<http://localhost:8080/test-1.0/test>
> 3. open new tab
> 4. go to http://localhost:8080/test-1.**0/test<http://localhost:8080/test-1.0/test>
> 5. click to submit
> 6. swicth to first tab
> 7. click to submit -> nothing happened
> 8. click to link -> it works
> 9. click to submit -> now it works too
> 10. go to second tab -> submit/link work fine
>
> Br,
> Jan
>
>
>
> On Thu, 24 Nov 2011 16:50:37 +0100, Dan Retzlaff <dr...@gmail.com>
> wrote:
>
>  Hi, Jan. Your code looks okay to me. I tested in Chrome myself using
>> 1.4.18
>> and 1.4.19 and was not able to reproduce your problem.
>>
>> On Thu, Nov 24, 2011 at 1:08 AM, Jan Loose <ja...@cleverlance.com>**
>> wrote:
>>
>>  Hello,
>>>
>>> we are using Wicket 1.4.18 and we found a problem if we open two pages
>>> then the AjaxLink works great but the AjaxSubmitLink doesn't. The page is
>>> mounted by HybridUrlCodingStrategy, but I've tried the normal
>>> bookmarkable
>>> mount and the behavior is the same. I've created a simple page, that
>>> demonstrates the problem.
>>>
>>> public class TestPage extends WebPage {
>>>
>>>   private String input;
>>>
>>>   public TestPage() {
>>>       Form<Void> form;
>>>       add(form = new Form<Void>("form"));
>>>
>>>       final TextField<String> inputField = new TextField<String>("input",
>>> new PropertyModel<String>(this, "input"));
>>>       form.add(inputField.****setOutputMarkupId(true));
>>>
>>>
>>>       form.add(new AjaxSubmitLink("submit") {
>>>
>>>           @Override
>>>           protected void onSubmit(AjaxRequestTarget target, Form<?> form)
>>> {
>>>               input = "submit " + Math.random();
>>>               target.addComponent(****inputField);
>>>
>>>           }
>>>       });
>>>       form.add(new AjaxLink<Void>("link") {
>>>
>>>           @Override
>>>           public void onClick(AjaxRequestTarget target) {
>>>               input = "link " + Math.random();
>>>               target.addComponent(****inputField);
>>>
>>>           }
>>>       });
>>>   }
>>>
>>>   public String getInput() {
>>>       return input;
>>>   }
>>>
>>>   public void setInput(String input) {
>>>       this.input = input;
>>>   }
>>> }
>>>
>>> <?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<http://www.w3.org/TR/xhtml1/**DTD/xhtml1-strict.dtd>
>>> <http://**www.w3.org/TR/xhtml1/DTD/**xhtml1-strict.dtd<http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
>>> >
>>> ">
>>> <html xmlns="http://www.w3.org/1999/****xhtml<http://www.w3.org/1999/**xhtml><
>>> http://www.w3.org/1999/xhtml>**"
>>> xmlns:wicket="http://wicket.****apache.org/dtds.data/wicket-**<http://apache.org/dtds.data/wicket-**>
>>> xhtml1.4-strict.dtd<http://**wicket.apache.org/dtds.data/**
>>> wicket-xhtml1.4-strict.dtd<http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd>
>>> >
>>>
>>> ">
>>> <head>
>>>   <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
>>>   <title>TestPage</title>
>>> </head>
>>> <body>
>>>   <form wicket:id="form">
>>>       <div>
>>>           <input wicket:id="input"/>
>>>           <a wicket:id="submit">submit</a>
>>>           <a wicket:id="link">link</a>
>>>       </div>
>>>   </form>
>>> </body>
>>> </html>
>>>
>>> Just open the page in two tabs in one browser (I've tested it in Opera
>>> and
>>> Chrome). In the first tab click to the submit link (AjaxSubmitLink) and
>>> then switch to the second page and click to the submit link too. Nothing
>>> happened. I investigated there is used EmptyAjaxRequestTarget, but I'm
>>> not
>>> sure why, because if try the same scenario using the second link
>>> (AjaxLink)
>>> then it works fine.
>>>
>>> Where is the problem? What am I doing wrong? How can I solve this
>>> problem?
>>>
>>> Best regards,
>>> Jan
>>>
>>>
>
> --
> Jan Loose
> J2EE Team Leader / Senior J2EE Developer
> ______________________________**_______________
> Cleverlance – CREATE IT
> člen Cleverlance Group
> www.cleverlance.com
>
> Dukelských hrdinů 34
> 170 00 Praha 7
> Czech Republic
>
> Tel: +420 266 177 166
> Mobil: +420 777 788 078
>

Re: two pages submit problem

Posted by Jan Loose <ja...@cleverlance.com>.
Hi,

I investigated a little bit and I found that it happened only for  
HttpSessionStore:

This is my test application:

public class TestApplication extends WebApplication {

     @Override
     public Class<? extends Page> getHomePage() {
         return TestPage.class;
     }

     @Override
     protected void init() {
         super.init();
         mount(new HybridUrlCodingStrategy("/test", TestPage.class));
     }

     @Override
     protected ISessionStore newSessionStore() {
         return new HttpSessionStore(this);
     }
}

The whole application is here: http://web.loose.cz/wicket/test.zip (maven  
+ war)

It is broken for Apache Tomcat 7 (Development) and for IBM WebSphere  
(Production) too, so it is not problem of one application server.

The steps needed to reproduction:
1. open browser
2. go to http://localhost:8080/test-1.0/test
3. open new tab
4. go to http://localhost:8080/test-1.0/test
5. click to submit
6. swicth to first tab
7. click to submit -> nothing happened
8. click to link -> it works
9. click to submit -> now it works too
10. go to second tab -> submit/link work fine

Br,
Jan


On Thu, 24 Nov 2011 16:50:37 +0100, Dan Retzlaff <dr...@gmail.com>  
wrote:

> Hi, Jan. Your code looks okay to me. I tested in Chrome myself using  
> 1.4.18
> and 1.4.19 and was not able to reproduce your problem.
>
> On Thu, Nov 24, 2011 at 1:08 AM, Jan Loose  
> <ja...@cleverlance.com>wrote:
>
>> Hello,
>>
>> we are using Wicket 1.4.18 and we found a problem if we open two pages
>> then the AjaxLink works great but the AjaxSubmitLink doesn't. The page  
>> is
>> mounted by HybridUrlCodingStrategy, but I've tried the normal  
>> bookmarkable
>> mount and the behavior is the same. I've created a simple page, that
>> demonstrates the problem.
>>
>> public class TestPage extends WebPage {
>>
>>    private String input;
>>
>>    public TestPage() {
>>        Form<Void> form;
>>        add(form = new Form<Void>("form"));
>>
>>        final TextField<String> inputField = new  
>> TextField<String>("input",
>> new PropertyModel<String>(this, "input"));
>>        form.add(inputField.**setOutputMarkupId(true));
>>
>>        form.add(new AjaxSubmitLink("submit") {
>>
>>            @Override
>>            protected void onSubmit(AjaxRequestTarget target, Form<?>  
>> form)
>> {
>>                input = "submit " + Math.random();
>>                target.addComponent(**inputField);
>>            }
>>        });
>>        form.add(new AjaxLink<Void>("link") {
>>
>>            @Override
>>            public void onClick(AjaxRequestTarget target) {
>>                input = "link " + Math.random();
>>                target.addComponent(**inputField);
>>            }
>>        });
>>    }
>>
>>    public String getInput() {
>>        return input;
>>    }
>>
>>    public void setInput(String input) {
>>        this.input = input;
>>    }
>> }
>>
>> <?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<http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
>> ">
>> <html xmlns="http://www.w3.org/1999/**xhtml  
>> <http://www.w3.org/1999/xhtml>"
>> xmlns:wicket="http://wicket.**apache.org/dtds.data/wicket-**
>> xhtml1.4-strict.dtd<http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd>
>> ">
>> <head>
>>    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
>>    <title>TestPage</title>
>> </head>
>> <body>
>>    <form wicket:id="form">
>>        <div>
>>            <input wicket:id="input"/>
>>            <a wicket:id="submit">submit</a>
>>            <a wicket:id="link">link</a>
>>        </div>
>>    </form>
>> </body>
>> </html>
>>
>> Just open the page in two tabs in one browser (I've tested it in Opera  
>> and
>> Chrome). In the first tab click to the submit link (AjaxSubmitLink) and
>> then switch to the second page and click to the submit link too. Nothing
>> happened. I investigated there is used EmptyAjaxRequestTarget, but I'm  
>> not
>> sure why, because if try the same scenario using the second link  
>> (AjaxLink)
>> then it works fine.
>>
>> Where is the problem? What am I doing wrong? How can I solve this  
>> problem?
>>
>> Best regards,
>> Jan
>>


-- 
Jan Loose
J2EE Team Leader / Senior J2EE Developer
_____________________________________________
Cleverlance – CREATE IT
člen Cleverlance Group
www.cleverlance.com

Dukelských hrdinů 34
170 00 Praha 7
Czech Republic

Tel: +420 266 177 166
Mobil: +420 777 788 078

Re: two pages submit problem

Posted by Dan Retzlaff <dr...@gmail.com>.
Hi, Jan. Your code looks okay to me. I tested in Chrome myself using 1.4.18
and 1.4.19 and was not able to reproduce your problem.

On Thu, Nov 24, 2011 at 1:08 AM, Jan Loose <ja...@cleverlance.com>wrote:

> Hello,
>
> we are using Wicket 1.4.18 and we found a problem if we open two pages
> then the AjaxLink works great but the AjaxSubmitLink doesn't. The page is
> mounted by HybridUrlCodingStrategy, but I've tried the normal bookmarkable
> mount and the behavior is the same. I've created a simple page, that
> demonstrates the problem.
>
> public class TestPage extends WebPage {
>
>    private String input;
>
>    public TestPage() {
>        Form<Void> form;
>        add(form = new Form<Void>("form"));
>
>        final TextField<String> inputField = new TextField<String>("input",
> new PropertyModel<String>(this, "input"));
>        form.add(inputField.**setOutputMarkupId(true));
>
>        form.add(new AjaxSubmitLink("submit") {
>
>            @Override
>            protected void onSubmit(AjaxRequestTarget target, Form<?> form)
> {
>                input = "submit " + Math.random();
>                target.addComponent(**inputField);
>            }
>        });
>        form.add(new AjaxLink<Void>("link") {
>
>            @Override
>            public void onClick(AjaxRequestTarget target) {
>                input = "link " + Math.random();
>                target.addComponent(**inputField);
>            }
>        });
>    }
>
>    public String getInput() {
>        return input;
>    }
>
>    public void setInput(String input) {
>        this.input = input;
>    }
> }
>
> <?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<http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
> ">
> <html xmlns="http://www.w3.org/1999/**xhtml <http://www.w3.org/1999/xhtml>"
> xmlns:wicket="http://wicket.**apache.org/dtds.data/wicket-**
> xhtml1.4-strict.dtd<http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd>
> ">
> <head>
>    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
>    <title>TestPage</title>
> </head>
> <body>
>    <form wicket:id="form">
>        <div>
>            <input wicket:id="input"/>
>            <a wicket:id="submit">submit</a>
>            <a wicket:id="link">link</a>
>        </div>
>    </form>
> </body>
> </html>
>
> Just open the page in two tabs in one browser (I've tested it in Opera and
> Chrome). In the first tab click to the submit link (AjaxSubmitLink) and
> then switch to the second page and click to the submit link too. Nothing
> happened. I investigated there is used EmptyAjaxRequestTarget, but I'm not
> sure why, because if try the same scenario using the second link (AjaxLink)
> then it works fine.
>
> Where is the problem? What am I doing wrong? How can I solve this problem?
>
> Best regards,
> Jan
>