You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by bayk <st...@gmx.net> on 2007/07/17 17:06:28 UTC
[T5] Passing Pages into Components
Hi!
I have a problem passing a page into a component. Its quite simple... The
component contains a form, which is responsible for the navigation (it
returns a Page by the onSuccess-Method). To allow further customization I
want to pass the page to the component by a parameter (e.g. nextPage). I can
run the page without problems, but if i successfully submit the form (->
call the onSuccess-Method) a java.lang.IllegalArgumentException is thrown.
(Could not find a coercion from type webshops.pages.article.ArticleList to
type org.apache.tapestry.internal.structure.Page. Available coercions:
Double --> Float, Float --> Double, ...)
A few pices of code might be helpful:
Component: ArticleSearch.java
[code]
....
@Parameter(required=true)
private Page nextPage;
public Page onSuccess() {
...
return nextPage;
}
[/code]
Implementation of the Component: ArticleSearchImpl.java
[code]
@InjectPage
private ArticleList articleList;
@Component(parameters={"nextPage=articleList"})
private com.poi.egh.webshops.components.article.ArticleSearch articleSearch;
public ArticleMaintenanceLayout getArticleMaintenanceLayout()
{
return articleMaintenanceLayout;
}
public ArticleList getArticleList()
{
return articleList;
}
[/code]
I have no idea why this doesnt work.....
klaus
--
View this message in context: http://www.nabble.com/-T5--Passing-Pages-into-Components-tf4097307.html#a11650728
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] Passing Pages into Components
Posted by Bill Holloway <bi...@gmail.com>.
Howard, maybe you should hide the internal interfaces by making them
package-private or something. Then mark internal classes "final" like
Spring does!
Bill
On 7/18/07, Howard Lewis Ship <hl...@gmail.com> wrote:
>
> So you missed the great big warning signs about not using internal
> classes?
>
> Page is an internal interface; you classes don't implement Page.
> You'd be better off making nextPage type java.lang.Object.
>
> On 7/17/07, bayk <st...@gmx.net> wrote:
> >
> > Hi!
> >
> > I have a problem passing a page into a component. Its quite simple...
> The
> > component contains a form, which is responsible for the navigation (it
> > returns a Page by the onSuccess-Method). To allow further customization
> I
> > want to pass the page to the component by a parameter (e.g. nextPage). I
> can
> > run the page without problems, but if i successfully submit the form (->
> > call the onSuccess-Method) a java.lang.IllegalArgumentException is
> thrown.
> > (Could not find a coercion from type webshops.pages.article.ArticleListto
> > type org.apache.tapestry.internal.structure.Page. Available coercions:
> > Double --> Float, Float --> Double, ...)
> >
> > A few pices of code might be helpful:
> >
> > Component: ArticleSearch.java
> > [code]
> > ....
> > @Parameter(required=true)
> > private Page nextPage;
> >
> > public Page onSuccess() {
> > ...
> > return nextPage;
> > }
> > [/code]
> >
> > Implementation of the Component: ArticleSearchImpl.java
> > [code]
> > @InjectPage
> > private ArticleList articleList;
> >
> > @Component(parameters={"nextPage=articleList"})
> > private com.poi.egh.webshops.components.article.ArticleSearcharticleSearch;
> >
> > public ArticleMaintenanceLayout getArticleMaintenanceLayout()
> > {
> > return articleMaintenanceLayout;
> > }
> >
> > public ArticleList getArticleList()
> > {
> > return articleList;
> > }
> > [/code]
> >
> > I have no idea why this doesnt work.....
> > klaus
> > --
> > View this message in context:
> http://www.nabble.com/-T5--Passing-Pages-into-Components-tf4097307.html#a11650728
> > Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> Howard M. Lewis Ship
> TWD Consulting, Inc.
> Independent J2EE / Open-Source Java Consultant
> Creator and PMC Chair, Apache Tapestry
> Creator, Apache HiveMind
>
> Professional Tapestry training, mentoring, support
> and project work. http://howardlewisship.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: [T5] Passing Pages into Components
Posted by Howard Lewis Ship <hl...@gmail.com>.
So you missed the great big warning signs about not using internal classes?
Page is an internal interface; you classes don't implement Page.
You'd be better off making nextPage type java.lang.Object.
On 7/17/07, bayk <st...@gmx.net> wrote:
>
> Hi!
>
> I have a problem passing a page into a component. Its quite simple... The
> component contains a form, which is responsible for the navigation (it
> returns a Page by the onSuccess-Method). To allow further customization I
> want to pass the page to the component by a parameter (e.g. nextPage). I can
> run the page without problems, but if i successfully submit the form (->
> call the onSuccess-Method) a java.lang.IllegalArgumentException is thrown.
> (Could not find a coercion from type webshops.pages.article.ArticleList to
> type org.apache.tapestry.internal.structure.Page. Available coercions:
> Double --> Float, Float --> Double, ...)
>
> A few pices of code might be helpful:
>
> Component: ArticleSearch.java
> [code]
> ....
> @Parameter(required=true)
> private Page nextPage;
>
> public Page onSuccess() {
> ...
> return nextPage;
> }
> [/code]
>
> Implementation of the Component: ArticleSearchImpl.java
> [code]
> @InjectPage
> private ArticleList articleList;
>
> @Component(parameters={"nextPage=articleList"})
> private com.poi.egh.webshops.components.article.ArticleSearch articleSearch;
>
> public ArticleMaintenanceLayout getArticleMaintenanceLayout()
> {
> return articleMaintenanceLayout;
> }
>
> public ArticleList getArticleList()
> {
> return articleList;
> }
> [/code]
>
> I have no idea why this doesnt work.....
> klaus
> --
> View this message in context: http://www.nabble.com/-T5--Passing-Pages-into-Components-tf4097307.html#a11650728
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind
Professional Tapestry training, mentoring, support
and project work. http://howardlewisship.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org