You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by JB...@ersus.com on 2005/08/19 16:13:48 UTC

Namespace problem with RequestCycle.getPage()

I'm having some namespace problems when using RequestCycle.getPage() in
Tapestry 4.0 beta 3. 

In my application specification file, I'm referencing a library - we'll call
it "libraryA". The library specification file for this library includes a
second library - "libraryB". LibraryB includes a page named "ExamplePage"
and that page is declared in the libraryB's spec file. 

The problem I'm having occurs when a page in LibraryA tries to call
getRequestCycle().getPage("libraryB:ExamplePage").  The error I get is,
"Library 'libraryB' not found in application namespace". If I a reference to
LibraryB directly into the application specification file I get a different
error - "Library 'libraryB' not found in namespace 'libraryB'."

Application Spec:
<application name="exampleApp">
	<library id="libraryA"
specification-path="/com/example/libraryA.library"/>
</application>

LibraryA Spec:
<library-specification>
   <library id="libraryB"
specification-path="/com/example/libraryB/libraryB.library"/>
</library-specification>

LibraryB Spec:
<library-specification>
   <page name="ExamplePage" specification-path="ExamplePage.page"/>
</library-specification>

Hope my explanation of the problem wasn't too confusing, I tried to simplify
it as much as possible.

Thanks in advance for the help,
John Barton

Re: Namespace problem with RequestCycle.getPage()

Posted by Marcus Brito <mb...@gmail.com>.
> Get its namespace:  IComponent.getNamespace()
> Get namespace b:  INamespace.getChildNamespace("libraryB");
> IPage page = cycle.getPage(namespaceb.getExtendedId() + ":MyPageInB");

It seems that RequestCycle could use a method to retrieve a page in a specified
namespace; something like 

IPage getPage(INamespace ns, String name);

This would abstract away the ":" notation for namespaces. I think the example
above would be a clearer if you could write:

cycle.getPage(getNamespace().getChildNamespace("libraryB"), "MyPageInB");

-- MB


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


Re: Namespace problem with RequestCycle.getPage()

Posted by Howard Lewis Ship <hl...@gmail.com>.
Pages inside Namespaces are tricky.

You need to start with a page or component from namespace A.

Get its namespace:  IComponent.getNamespace()

Get namespace b:  INamespace.getChildNamespace("libraryB");

IPage page = cycle.getPage(namespaceb.getExtendedId() + ":MyPageInB");

On 8/19/05, JBarton@ersus.com <JB...@ersus.com> wrote:
> I'm having some namespace problems when using RequestCycle.getPage() in
> Tapestry 4.0 beta 3.
> 
> In my application specification file, I'm referencing a library - we'll call
> it "libraryA". The library specification file for this library includes a
> second library - "libraryB". LibraryB includes a page named "ExamplePage"
> and that page is declared in the libraryB's spec file.
> 
> The problem I'm having occurs when a page in LibraryA tries to call
> getRequestCycle().getPage("libraryB:ExamplePage").  The error I get is,
> "Library 'libraryB' not found in application namespace". If I a reference to
> LibraryB directly into the application specification file I get a different
> error - "Library 'libraryB' not found in namespace 'libraryB'."
> 
> Application Spec:
> <application name="exampleApp">
>         <library id="libraryA"
> specification-path="/com/example/libraryA.library"/>
> </application>
> 
> LibraryA Spec:
> <library-specification>
>    <library id="libraryB"
> specification-path="/com/example/libraryB/libraryB.library"/>
> </library-specification>
> 
> LibraryB Spec:
> <library-specification>
>    <page name="ExamplePage" specification-path="ExamplePage.page"/>
> </library-specification>
> 
> Hope my explanation of the problem wasn't too confusing, I tried to simplify
> it as much as possible.
> 
> Thanks in advance for the help,
> John Barton
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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