A solution to what you're describing would be this:
In your pages that require properties to be set,
define a method such as
public void activate(Long userId, Date date, ...)
{
this.setUserId(userId);
this.setDate(date);
getRequestCycle.activate(this);
}
And so, from other pages use this:
public abstract class MyPage extends BasePage {
@InjectPage("AnotherPage")
public abstract AnotherPage getAnotherPage();
public void doSomething(Long userId, Date date) {
AnotherPage anotherPage = getAnotherPage();
anotherPage.activate(userId, date);
}
}
Finally, for yet another solution, you might want to take a look at the
IExternalPage interface
and the ExternalLink component.
Claus Nielsen (BM Data) wrote:
Oh, so that's what I'm doing wrong.
It _is_ a page, and I _have_ defined parameters on it using
@Parameter(required=true).
I guess I'll just have to stop doing that - without the annotation it
works. It would be nice to have it though. The page has a lot of
attributes, and without the @Parameter annotation it isn't obvious which
fields a caller must set before activating the page.
This certainly wasn't the answer I'd hoped for, but thank you very much
anyway. It certainly saved me from wasting a _lot_ of time digging
around for a solution myself.
Kind Regards
Claus Nielsen
-----Oprindelig meddelelse-----
Fra: Andreas Andreou [mailto:[EMAIL PROTECTED]
Sendt: 18. oktober 2005 12:43
Til: Tapestry users
Emne: Re: Required parameter xxx of component Yyyy is not bound
In Tapestry, Pages differ from Components in that they don't
have any parameters, nor optional, nor required.
So, I don't understand why you're getting this problem.
Can you show us the exception stack trace?
Maybe you're trying to activate a Component instead of a Page?
Claus Nielsen (BM Data) wrote:
Hi.
How do I make a DirectLink listener in one page activate another page
which has (required) parameters?
I have a page class which looks something like this:
public abstract class MyPage extends BasePage {
@InjectPage("AnotherPage")
public abstract AnotherPage getAnotherPage();
public IPage doSomething(ParameterForAnotherPage parm) {
AnotherPage anotherPage = getAnotherPage(); // Causes exception
return anotherPage;
}
}
This works if AnotherPage dosn't have any parameters. If it requires
a
parameter I get a org.apache.hivemind.ApplicationRuntimeException
saying
that "Required parameter xxx of component AnotherPage is not bound".
How do I pass / bind a paramter to AnotherPage?
Kind Regards
Claus Nielsen
Bonnier Magazine Data A/S
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: tapestry-user-
[EMAIL PROTECTED]
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]