You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kevin Menard <km...@servprise.com> on 2007/10/30 20:26:08 UTC

T5: Multiple onActivate?

Hi all,

It appears that onActivate() cannot be overloaded in a single page class.
I'm hoping I just missed something and that conclusion is wrong.  If not,
how are others handling URLs like:

"news/43"  (43 = DB ID)
"new/breaking-story"  (breaking-story=slug)

I'd like to avoid a single onActivate() that takes an Object.  So, any help
would be much appreciated.

Thanks,
Kevin



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


Re: T5: Multiple onActivate?

Posted by Kevin Menard <km...@servprise.com>.
In some ways I'd agree, in others I wouldn't.  I'm finding cases where T5
really made some simple well-defined aspects from previous generations much
more difficult than they need be.  These will be getting added to JIRA
though.

All in all though, I do like a lot of the improvements.  I'll have to check
out Alexander's book I suppose as well, since the documentation is a bit
lacking at the moment.

-- 
Kevin


On 10/30/07 9:05 PM, in article
3ca416e60710301805v284ffce1nf1caf3f6f93c5c32@mail.gmail.com, "Marcus"
<mv...@gmail.com> wrote:

> Kevin,
> 
> On this process, T3 ->T4 ->T5, just keep in mind that Tapestry 5 is much
> more simple.
> 
> Marcus



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


Re: T5: Multiple onActivate?

Posted by Marcus <mv...@gmail.com>.
Kevin,

On this process, T3 ->T4 ->T5, just keep in mind that Tapestry 5 is much
more simple.

Marcus

Re: T5: Multiple onActivate?

Posted by Kevin Menard <km...@servprise.com>.
On the surface, I'd like to preserve the bookmarks.  Like I said though, I
could do that with URLRewrite -- not ideal, but guaranteed to work.

Digging further, I'm trying to wrap my head around how Tapestry resolves
page names in T5, having been a T3 then a T4 user.  The problems I'm running
into seem like they really shouldn't be problems and should be a common case
that Tapestry should make easy to handle.  So, I'm willing to give the
framework the benefit of the doubt and correct my understanding.  If not,
that's fine, too.  I'll make a mental note not to try to do these things or
reevaluate if it's to be my new framework of choice.

For what it's worth, I'm working on migrating an application from django to
T5.  There are a variety of reasons for this, both technical and political.
Ultimately, I'd like to see Java and Tapestry be a suitable replacement for
the flexibility of Python and Django.

-- 
Kevin 


On 10/30/07 7:51 PM, in article 000901c81b4f$d34e27a0$6502a8c0@DrJLaptop,
"Jonathan Barker" <jo...@gmail.com> wrote:

> I don't know.
> 
> There have been some threads and I think JIRA issues over the months on
> similar topics.  They revolve around making Tapestry URL's friendly, and the
> logic involved in having something like Order/EditOrder reduced down to
> order/edit, and dealing with cases when the package name is the same as the
> page name, or even worse, if a parameter looks like a page name.
> 
> A search for those threads and issues might give you some ideas.
> 
> Are you just trying to preserve bookmarks?  Is this something where you
> really need to code the logic to cope with the old URL's while migrating to
> a new URL scheme?
> 



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


RE: T5: Multiple onActivate?

Posted by Jonathan Barker <jo...@gmail.com>.
I don't know.

There have been some threads and I think JIRA issues over the months on
similar topics.  They revolve around making Tapestry URL's friendly, and the
logic involved in having something like Order/EditOrder reduced down to
order/edit, and dealing with cases when the package name is the same as the
page name, or even worse, if a parameter looks like a page name.

A search for those threads and issues might give you some ideas.

Are you just trying to preserve bookmarks?  Is this something where you
really need to code the logic to cope with the old URL's while migrating to
a new URL scheme?

Jon


> -----Original Message-----
> From: news [mailto:news@ger.gmane.org] On Behalf Of Kevin Menard
> Sent: Tuesday, October 30, 2007 3:58 PM
> To: users@tapestry.apache.org
> Subject: Re: T5: Multiple onActivate?
> 
> Hmm . . . Okay, that's what I was afraid of.  Unfortunately, it's a port
> of
> an existing app, so I'd like to preserve URL structure if possible.  I
> supposed URLRewrite could do the trick.
> 
> As a follow-up question, is there anyway to do the following:
> 
> "orders/43" (DB ID, caught through onActivate())
> "orders/latest" (specified in com.example.www.pages.orders.Latest)
> 
> It looks like Tapestry will still try to pass "latest" through to
> com.example.www.pages.Orders.  I also couldn't figure out how to have a
> "Start" class for each package, so that the first URL would actually map
> to
> com.example.www.pages.orders.Start.
> 
> Is that doable, or do I have to work around it as well?
> 
> Thanks,
> Kevin
> 
> 
> On 10/30/07 3:54 PM, in article 009001c81b2e$bbce6390$5200000a@DrJLaptop,
> "Jonathan Barker" <jo...@gmail.com> wrote:
> 
> >
> >
> > For this use-case, I would suggest taking a string.  If it matches a
> regex
> > (like a number pattern), then cast and do a db-lookup.  Otherwise, do
> > whatever else you want to do.
> >
> > Or you can use something like news/lookup/43 and
> > news/breaking/breaking-story to be more explicit.
> >
> >
> >
> >> -----Original Message-----
> >> From: news [mailto:news@ger.gmane.org] On Behalf Of Kevin Menard
> >> Sent: Tuesday, October 30, 2007 3:26 PM
> >> To: users@tapestry.apache.org
> >> Subject: T5: Multiple onActivate?
> >>
> >> Hi all,
> >>
> >> It appears that onActivate() cannot be overloaded in a single page
> class.
> >> I'm hoping I just missed something and that conclusion is wrong.  If
> not,
> >> how are others handling URLs like:
> >>
> >> "news/43"  (43 = DB ID)
> >> "new/breaking-story"  (breaking-story=slug)
> >>
> >> I'd like to avoid a single onActivate() that takes an Object.  So, any
> >> help
> >> would be much appreciated.
> >>
> >> Thanks,
> >> Kevin
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


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


Re: T5: Multiple onActivate?

Posted by Kevin Menard <km...@servprise.com>.
That did help a bit.  At least I know how multiple onActivate can work if I
need a variable number of context values.  Unfortunately, it doesn't address
when you have the same number, but different type.

Likewise, I still haven't seen how to render to "index" pages inside
subpackages.

-- 
Kevin


On 10/30/07 4:12 PM, in article
3ca416e60710301312j71a7f3d9tf78bb63c819292cd@mail.gmail.com, "Marcus"
<mv...@gmail.com> wrote:

> Hi Kevin,
> 
> Maybe this help
> 
> http://tapestryjava.blogspot.com/2007/08/handling-direct-urls-in-tapestry-5.ht
> ml
> 
> Marcus



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


Re: T5: Multiple onActivate?

Posted by Marcus <mv...@gmail.com>.
Hi Kevin,

Maybe this help

http://tapestryjava.blogspot.com/2007/08/handling-direct-urls-in-tapestry-5.html

Marcus

Re: T5: Multiple onActivate?

Posted by Kevin Menard <km...@servprise.com>.
Hmm . . . Okay, that's what I was afraid of.  Unfortunately, it's a port of
an existing app, so I'd like to preserve URL structure if possible.  I
supposed URLRewrite could do the trick.

As a follow-up question, is there anyway to do the following:

"orders/43" (DB ID, caught through onActivate())
"orders/latest" (specified in com.example.www.pages.orders.Latest)

It looks like Tapestry will still try to pass "latest" through to
com.example.www.pages.Orders.  I also couldn't figure out how to have a
"Start" class for each package, so that the first URL would actually map to
com.example.www.pages.orders.Start.

Is that doable, or do I have to work around it as well?

Thanks,
Kevin


On 10/30/07 3:54 PM, in article 009001c81b2e$bbce6390$5200000a@DrJLaptop,
"Jonathan Barker" <jo...@gmail.com> wrote:

> 
> 
> For this use-case, I would suggest taking a string.  If it matches a regex
> (like a number pattern), then cast and do a db-lookup.  Otherwise, do
> whatever else you want to do.
> 
> Or you can use something like news/lookup/43 and
> news/breaking/breaking-story to be more explicit.
> 
> 
> 
>> -----Original Message-----
>> From: news [mailto:news@ger.gmane.org] On Behalf Of Kevin Menard
>> Sent: Tuesday, October 30, 2007 3:26 PM
>> To: users@tapestry.apache.org
>> Subject: T5: Multiple onActivate?
>> 
>> Hi all,
>> 
>> It appears that onActivate() cannot be overloaded in a single page class.
>> I'm hoping I just missed something and that conclusion is wrong.  If not,
>> how are others handling URLs like:
>> 
>> "news/43"  (43 = DB ID)
>> "new/breaking-story"  (breaking-story=slug)
>> 
>> I'd like to avoid a single onActivate() that takes an Object.  So, any
>> help
>> would be much appreciated.
>> 
>> Thanks,
>> Kevin
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 



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


RE: T5: Multiple onActivate?

Posted by Jonathan Barker <jo...@gmail.com>.

For this use-case, I would suggest taking a string.  If it matches a regex
(like a number pattern), then cast and do a db-lookup.  Otherwise, do
whatever else you want to do.

Or you can use something like news/lookup/43 and
news/breaking/breaking-story to be more explicit.



> -----Original Message-----
> From: news [mailto:news@ger.gmane.org] On Behalf Of Kevin Menard
> Sent: Tuesday, October 30, 2007 3:26 PM
> To: users@tapestry.apache.org
> Subject: T5: Multiple onActivate?
> 
> Hi all,
> 
> It appears that onActivate() cannot be overloaded in a single page class.
> I'm hoping I just missed something and that conclusion is wrong.  If not,
> how are others handling URLs like:
> 
> "news/43"  (43 = DB ID)
> "new/breaking-story"  (breaking-story=slug)
> 
> I'd like to avoid a single onActivate() that takes an Object.  So, any
> help
> would be much appreciated.
> 
> Thanks,
> Kevin
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


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