You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Entropy <bl...@gmail.com> on 2015/10/23 15:40:50 UTC

StalePageException

I am having a problem where I am always getting a StalePageException,
whenever the ajax request is sent for an AbstractDefaultAjaxBehavior. The
url for the callback to the AbstractDefaultAjaxBehavior is stored in a
HiddenField. This value apparently has a stale page version number(I suspect
this is the reason for StalePageException). How do I avoid this problem. I
don't believe that the page is made stale by a refreshing of the page etc,
since the trigger for callBack() on client-side is the first action taken.
What could cause this issue and what is the best practice for storing the
callback URL for an AbstractDefaultAjaxBehavior? 

thanks in advance for any help. 

java code: 

            AbstractDefaultAjaxBehavior behaviorDisable = new
AbstractDefaultAjaxBehavior() { 
                      
               private static final long serialVersionUID = 1L; 

               protected void respond(final AjaxRequestTarget target) { 
              System.out.println("here"); 
            }   
                
        }; 
        
        form.add(behaviorDisable); 
        String callback =
String.valueOf((behaviorDisable.getCallbackUrl())); 
        HiddenField hiddenfield = new HiddenField("callBackUrl", new
Model(callback)); 
        form.add(hiddenfield); 


html: 

  <form wicket:id="form">
  
        <input type="hidden" wicket:id="callBackUrl" id="callBackUrl" />


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/StalePageException-tp4672323.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: StalePageException

Posted by Sven Meier <sv...@meiers.net>.
Hi,

first please ensure that the url is up to date all the time:

         HiddenField hiddenfield = new HiddenField("callBackUrl", new AbstractReadOnlyModel() {
              public String getObject() {
                  return behaviorDisable.getCallbackUrl();
              }
         });


Have fun
Sven


On 23.10.2015 15:40, Entropy wrote:
> I am having a problem where I am always getting a StalePageException,
> whenever the ajax request is sent for an AbstractDefaultAjaxBehavior. The
> url for the callback to the AbstractDefaultAjaxBehavior is stored in a
> HiddenField. This value apparently has a stale page version number(I suspect
> this is the reason for StalePageException). How do I avoid this problem. I
> don't believe that the page is made stale by a refreshing of the page etc,
> since the trigger for callBack() on client-side is the first action taken.
> What could cause this issue and what is the best practice for storing the
> callback URL for an AbstractDefaultAjaxBehavior?
>
> thanks in advance for any help.
>
> java code:
>
>              AbstractDefaultAjaxBehavior behaviorDisable = new
> AbstractDefaultAjaxBehavior() {
>                        
>                 private static final long serialVersionUID = 1L;
>
>                 protected void respond(final AjaxRequestTarget target) {
>                System.out.println("here");
>              }
>                  
>          };
>          
>          form.add(behaviorDisable);
>          String callback =
> String.valueOf((behaviorDisable.getCallbackUrl()));
>          HiddenField hiddenfield = new HiddenField("callBackUrl", new
> Model(callback));
>          form.add(hiddenfield);
>
>
> html:
>
>    <form wicket:id="form">
>    
>          <input type="hidden" wicket:id="callBackUrl" id="callBackUrl" />
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/StalePageException-tp4672323.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org