It is slightly awkward; you have to get your own namespace and get its
extended (fully qualified id), example
(from Workbench Palette):

/**

* Invoked before {@link #formSubmit(IRequestCycle)} if the

* user clicks the "advance" button.

*

**/

public void advance(IRequestCycle cycle)

{

// Since Palette and palette.Results come from

// a library now, we need to make sure

// the namespace id is part of the name.

Results results = (Results) cycle.getPage(getNamespace().getExtendedId() +
":palette.Results");

results.setSelectedColors(_selectedColors);

cycle.setPage(results);

}


----- Original Message -----
From: "Richard Lewis-Shell" <[EMAIL PROTECTED]>
To: "Tapestry Developer (E-mail)" <[EMAIL PROTECTED]>
Sent: Tuesday, October 01, 2002 3:34 AM
Subject: [Tapestry-developer] 2.2: How does a library component refer to a
fellow library page?


> Hi,
>
> How does a library component refer to a fellow library page?
>
> I have an action listener in a library component that needs to invoke
> cycle.setPage() with a page from the same library.  Using
> cycle.setPage("MyLibPage") does not work - I get an exception saying that
> MyLibPage is not found in the framework namespace (see below for the gory
> exception details).
>
> I can change it to cycle.setPage("MyLib:MyLibPage"), but I am concerned
that
> this relies on consumers of the library naming the library "MyLib".  If I
> understand libraries correctly (and I may not!), someone might decide to
use
> my library by defining it with a different id - eg. <library
id="HisLibrary"
> specification-path="/path/to/My.library"/>.  Will this break the setPage
in
> my component?  If so, what is the correct way to refer to the page?
>
> Or perhaps cycle.getPage(String) (which is ultimately called by
> setPage(String)) is looking in the wrong place - though I'm not sure how
it
> could locate the library spec for the component, as wasn't there a
> deliberate decision made not to have a component specify its library?
> (Although, Spindle manages to figure it out ...)
>
> I hope this makes sense to someone else!?!
>
> Gory exception details:
> net.sf.tapestry.ApplicationRuntimeException
> Page 'LogoutPage' not found in framework namespace.
> Stack Trace:
>
net.sf.tapestry.engine.Namespace.locatePageSpecification(Namespace.java:244)
> net.sf.tapestry.engine.Namespace.getPageSpecification(Namespace.java:160)
>
net.sf.tapestry.pageload.PageSource$PageSpecificationResolver.getSpecificati
> on(PageSource.java:140)
> net.sf.tapestry.pageload.PageSource.getPage(PageSource.java:219)
> net.sf.tapestry.engine.RequestCycle.getPage(RequestCycle.java:226)
> net.sf.tapestry.engine.RequestCycle.setPage(RequestCycle.java:626)
>
> Richard
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by: DEDICATED SERVERS only $89!
> Linux or FreeBSD, FREE setup, FAST network. Get your own server
> today at http://www.ServePath.com/indexfm.htm
> _______________________________________________
> Tapestry-developer mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/tapestry-developer
>



-------------------------------------------------------
This sf.net email is sponsored by: DEDICATED SERVERS only $89!
Linux or FreeBSD, FREE setup, FAST network. Get your own server 
today at http://www.ServePath.com/indexfm.htm
_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer

Reply via email to