lets say I have a view product page which expects the product id in
its context.  The URL for this might look like
"http://app-root/product/view/12345";.

What is the best way to detect if the user modifies their URL to
"http://app-root/product/view"; without the context?

The only way I've found is to do something like the following:

public class ViewProduct {

   @Property
   private Product product;

   Object onActivate() {
      if( product == null ) {
         return RedirectPage.class;
      }
      return null;
   }

   void onActivate( Product product ) {
      this.product = product;
   }

}

I found that only onActivate() gets called when the context is
missing, but that both of them are called if the context is present.
The order of exection is as follows:

onActivate(Product)
onActivate()

This leads me into a second question:  Is this the way it is supposed
to behave (it seems wierd to me), and if so why is this the preferred
behavior?

Also, returning to my original question, is this the best way to
handle pages without context?  It seems like there should be a better
way.

Thanks in advance,
pete.pou...@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to