You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Koen Segers <Ko...@scarlet.be> on 2005/02/03 18:57:52 UTC

Message page

Hi,

Lots of pages contain simple messages as "Welcome X, " after successfull 
login. Therefore I believe it would be nice to have a page Message that has a 
Insert component one can set when a form is completed.
The question is how can I set the string of that component so that when 
redirecting to that page the correct string is showed?

This is what I have:
IPage page = cycle.getPage("Message");
Insert messagecomp = (Insert)page.getComponent("message");
messagecomp.setProperty("value", "Welcome, "+userName);
cycle.activate(page);

But the message component still stays empty.
What have I done wrong?

Greetz
-- 

Koen Segers

<ko...@scarlet.be>
<http://eddyvite.dyndns.org>

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


Re: Message page

Posted by Jamie Orchard-Hays <ja...@dang.com>.
A couple of things I see right off. First is that your casting as IPage. 
Does IPage have a message component? It has a message property, but the 
IPage interface doesn't have a Message Component.

Second, if you want to get a use a page, cast to that page:
Message page = (Message)cycle.getPage("Message");

That way you can get completion and type checking in your IDE, as well as 
more compile-time checking.

Finally, what I would do is have a property on my base page for the message 
(be careful, getMessage() is built in to Tapestry's BasePage!). This 
property would take a string. Then if the string isn't null or empty, 
display your Message component when the page renders (this would go in your 
Border component).

Jamie




----- Original Message ----- 
From: "Koen Segers" <Ko...@scarlet.be>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Thursday, February 03, 2005 12:57 PM
Subject: Message page


> Hi,
>
> Lots of pages contain simple messages as "Welcome X, " after successfull
> login. Therefore I believe it would be nice to have a page Message that 
> has a
> Insert component one can set when a form is completed.
> The question is how can I set the string of that component so that when
> redirecting to that page the correct string is showed?
>
> This is what I have:
> IPage page = cycle.getPage("Message");
> Insert messagecomp = (Insert)page.getComponent("message");
> messagecomp.setProperty("value", "Welcome, "+userName);
> cycle.activate(page);
>
> But the message component still stays empty.
> What have I done wrong?
>
> Greetz
> -- 
>
> Koen Segers
>
> <ko...@scarlet.be>
> <http://eddyvite.dyndns.org>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


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