Josh,

That's exactly what I was looking for.  Thanks a bunch!

Andy

On Wed, 2008-01-02 at 22:55 -0800, Josh Canfield wrote:
> I think what you're looking for is ComponentClassResolver, you can inject it
> into your page. It has two methods:
> 
> resolvePageClassNameToPageName();
> canonicalizePageName();
> 
> I'm still back on 5.0.6, so no guarantees that this still works in 5.0.7.
> 
> Josh
> 
> On Jan 2, 2008 8:34 PM, Andy Huhn <[EMAIL PROTECTED]> wrote:
> 
> > All,
> >
> > Short version of the question:
> > Is there a method somewhere in Tapestry that will return
> > "messages/Contact" if I pass it a class
> > com.blahblahblah.pages.messages.Contact?  I'm trying to pass a page name
> > to ComponentResources.createPageLink, and I don't want to hardcode the
> > page name...I'd like to use the class definition of the page, so if I
> > refactor and move the page around to different directories, my code
> > doesn't break.
> >
> > Long version of the question:
> > I'd like to use ComponentResources.createPageLink to create a link.  The
> > quirk is that instead of giving it a hard-coded string that is the name
> > of a page, I'd like to instead use the name of the class, so that when I
> > refactor (and move the page from one directory to another), my hardcoded
> > string doesn't break.
> >
> > Right now, I'm using this:
> > com.blahblahblah.pages.Contact.class.getSimpleName(), where "Contact" is
> > the name of the page.  This gives me a String that I can pass to
> > ComponentResources.createPageLink as a page name.
> >
> > This works as long as the page is located in the package named
> > com.blahblahblah.pages.  However, if I want to create a subpackage
> >
> > com.blahblahblah.pages.messages.Contact
> >
> > then I can no longer use this (simpleName() returns "Contact", but the
> > createPageLink() method needs "messages/Contact").
> >
> > So my question is this: is there a method somewhere in Tapestry that
> > will return "messages/Contact" if I pass it a class
> > com.blahblahblah.pages.messages.Contact?
> >
> > Thanks,
> > Andy
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> 

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

Reply via email to