You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Joshua Martin <jo...@gmail.com> on 2009/08/06 05:15:17 UTC

TextField Setting Text

How do I set the text for a TextField programatically?

I'm redirecting to a page I create programatically like this, and I
need to set the text with Strings I'm passing from my starting page:

@InjectPage
private PageToCreate page;

Object onAction()
{
    String textToSet = "Me the text";

    return page.initialize(textToSet);
}

-- 
_________________________________

Joshua S. Martin


CONFIDENTIALITY NOTE: This e-mail message, including any
attachment(s), contains information that may be confidential,
protected by the attorney client or other legal privileges, and or
proprietary non public information. If you are not an intended
recipient of this message or an authorized assistant to an intended
recipient, please notify the sender by replying to this message and
then delete it from your system. Use, dissemination, distribution, or
reproduction of this message and or any of its attachments (if any) by
unintended recipients is not authorized and may be unlawful.

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


Re: TextField Setting Text

Posted by DH <ni...@gmail.com>.
Since T5's redirect after post, there needs some extra work to pass value between pages, and you have to make sure that the value must be in the activation context in the next page.

In your PageToCreate.java:

@PageActivationContext //make sure the value in the context
@Property
private String textToSet;

public initialize(String textToSet) {
    this.textToSet = textToSet;
}

In your PageToCreate.tml

<input t:type="textfield" t:value="textToSet"/>

DH
http://www.gaonline.com.cn

----- Original Message ----- 
From: "Joshua Martin" 
To: <us...@tapestry.apache.org>
Sent: Thursday, August 06, 2009 11:15 AM
Subject: TextField Setting Text


> How do I set the text for a TextField programatically?
> 
> I'm redirecting to a page I create programatically like this, and I
> need to set the text with Strings I'm passing from my starting page:
> 
> @InjectPage
> private PageToCreate page;
> 
> Object onAction()
> {
>    String textToSet = "Me the text";
> 
>    return page.initialize(textToSet);
> }
> 
> -- 
> _________________________________
> 
> Joshua S. Martin
> 
> 
> CONFIDENTIALITY NOTE: This e-mail message, including any
> attachment(s), contains information that may be confidential,
> protected by the attorney client or other legal privileges, and or
> proprietary non public information. If you are not an intended
> recipient of this message or an authorized assistant to an intended
> recipient, please notify the sender by replying to this message and
> then delete it from your system. Use, dissemination, distribution, or
> reproduction of this message and or any of its attachments (if any) by
> unintended recipients is not authorized and may be unlawful.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
>

Re: TextField Setting Text

Posted by Joshua Martin <jo...@gmail.com>.
This works almost perfectly, but I have one small problem with this
method of redirecting...

I understand why the page is located at
/pageRedirectedFrom/pageRedirectedTo instead of just /pageRedirectedTo
but this is a problem because my images in the page are getting
pointed to a non existent URL

What can I do to solve this?


On Thu, Aug 6, 2009 at 5:03 AM, Peter
Stavrinides<P....@albourne.com> wrote:
> Or another valid way:
> @InjectPage
> private PageToCreate page;
>
> Object onAction()
> {
>    String textToSet = "Me the text";
>    page.initialize(textToSet);
>    return page;
> }
>
> Note:  page.initialize(textToSet); is obviously the method setting the property, but that property may need at least flash persistence.
> Peter
>
> ----- Original Message -----
> From: "Joshua Martin" <jo...@gmail.com>
> To: users@tapestry.apache.org
> Sent: Thursday, 6 August, 2009 06:15:17 GMT +02:00 Athens, Beirut, Bucharest, Istanbul
> Subject: TextField Setting Text
>
> How do I set the text for a TextField programatically?
>
> I'm redirecting to a page I create programatically like this, and I
> need to set the text with Strings I'm passing from my starting page:
>
> @InjectPage
> private PageToCreate page;
>
> Object onAction()
> {
>    String textToSet = "Me the text";
>
>    return page.initialize(textToSet);
> }
>
> --
> _________________________________
>
> Joshua S. Martin
>
>
> CONFIDENTIALITY NOTE: This e-mail message, including any
> attachment(s), contains information that may be confidential,
> protected by the attorney client or other legal privileges, and or
> proprietary non public information. If you are not an intended
> recipient of this message or an authorized assistant to an intended
> recipient, please notify the sender by replying to this message and
> then delete it from your system. Use, dissemination, distribution, or
> reproduction of this message and or any of its attachments (if any) by
> unintended recipients is not authorized and may be unlawful.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
_________________________________

Joshua S. Martin


CONFIDENTIALITY NOTE: This e-mail message, including any
attachment(s), contains information that may be confidential,
protected by the attorney client or other legal privileges, and or
proprietary non public information. If you are not an intended
recipient of this message or an authorized assistant to an intended
recipient, please notify the sender by replying to this message and
then delete it from your system. Use, dissemination, distribution, or
reproduction of this message and or any of its attachments (if any) by
unintended recipients is not authorized and may be unlawful.

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


Re: TextField Setting Text

Posted by Peter Stavrinides <P....@albourne.com>.
Or another valid way:
@InjectPage
private PageToCreate page;

Object onAction()
{
    String textToSet = "Me the text";
    page.initialize(textToSet);
    return page;
}

Note:  page.initialize(textToSet); is obviously the method setting the property, but that property may need at least flash persistence.
Peter

----- Original Message -----
From: "Joshua Martin" <jo...@gmail.com>
To: users@tapestry.apache.org
Sent: Thursday, 6 August, 2009 06:15:17 GMT +02:00 Athens, Beirut, Bucharest, Istanbul
Subject: TextField Setting Text

How do I set the text for a TextField programatically?

I'm redirecting to a page I create programatically like this, and I
need to set the text with Strings I'm passing from my starting page:

@InjectPage
private PageToCreate page;

Object onAction()
{
    String textToSet = "Me the text";

    return page.initialize(textToSet);
}

-- 
_________________________________

Joshua S. Martin


CONFIDENTIALITY NOTE: This e-mail message, including any
attachment(s), contains information that may be confidential,
protected by the attorney client or other legal privileges, and or
proprietary non public information. If you are not an intended
recipient of this message or an authorized assistant to an intended
recipient, please notify the sender by replying to this message and
then delete it from your system. Use, dissemination, distribution, or
reproduction of this message and or any of its attachments (if any) by
unintended recipients is not authorized and may be unlawful.

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


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