Your page implementing Externalizable breaks wicket. Wicket relies of
Page#writeReplace, writeObject, readObject being called. Are you sure
you're no seing any stacktrace?

-Matej

On Sat, Mar 15, 2008 at 3:08 AM, James Carman
<[EMAIL PROTECTED]> wrote:
> All,
>
>  I am trying to understand page serialization/deserialization a bit
>  better, so I create a Quickstart project and started tinkering.  I
>  modified the HomePage class as follows:
>
>  public class HomePage extends WebPage implements Externalizable
>  {
>     private static final Logger log = LoggerFactory.getLogger(HomePage.class);
>     private static final long serialVersionUID = 1L;
>     private int counter;
>
>     public HomePage(final PageParameters parameters)
>     {
>         add(new Label("message", new Model()
>         {
>             public Object getObject()
>             {
>                 return "I've been called " + counter++ + " times.";
>             }
>         } ) );
>
>         add(new Link("refresh")
>         {
>             public void onClick()
>             {
>                 log.info("My id is " + 
> System.identityHashCode(HomePage.this));
>             }
>         } );
>     }
>
>     public void writeExternal(ObjectOutput out) throws IOException
>     {
>         log.info("I'm being serialized!");
>     }
>
>     public void readExternal(ObjectInput in) throws IOException,
>  ClassNotFoundException
>     {
>         log.info("I'm being deserialized!");
>     }
>  }
>
>  And, my html template is as follows:
>
>  <html>
>     <head>
>         <title>Wicket Quickstart Archetype Homepage</title>
>     </head>
>     <body>
>         <strong>Wicket Quickstart Archetype Homepage</strong>
>         <br/><br/>
>         <span wicket:id="message">message will be here</span>
>         <p>
>             Click <a href="." wicket:id="refresh">here</a> to refresh!
>         </p>
>     </body>
>  </html>
>
>
>  Maybe I'm just not understanding this correctly (entire possible), but
>  here's what I tried:
>
>  1.  Load the home page.
>  2.  Click the "refresh" link
>  3.  Hit the back button
>  4.  Click the "refresh" link again
>
>  Now, every time I do that, it updates the "counter" variable every
>  time I click the "refresh" link.  When I hit the back button after the
>  link is clicked, the link points to
>  "http://localhost:8080/?wicket:interface=:1:refresh::ILinkListener::";.
>   I would assume that when I clicked the refresh link after doing the
>  back button that the counter wouldn't update (it'd be 1).  Also, the
>  "I'm being deserialized" is never called.  Am I misunderstanding?
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Resizable and reorderable grid components.
http://www.inmethod.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to