You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Todd O'Bryan <to...@mac.com> on 2004/03/14 13:49:10 UTC

passing message to a new page

I've finally got a Tapestry application doing stuff. I have a Login 
page, a Main Menu, and a Create User page that actually inserts users 
into a database and includes a PropertySelection drop-down menu that I 
created from a Hibernate PersistentEnum class. (BTW, does anybody have 
something ready-made to connect PersistentEnums to PropertySelections 
since it seems that would be a common thing to do?)

Here's my real question. After someone creates a new user, I'd like to 
put up a page saying that the user was added correctly, and then give 
options of going back to the Main Menu or to create another user. How 
can I pass a message to this new page that gives the user info if 
successful, or has an error if not?

Todd


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


Re: passing message to a new page

Posted by Todd O'Bryan <to...@mac.com>.
Thanks!

I actually had a bit of an epiphany about 10 minutes after sending my 
post. I defined a new class MessagePage that extended BasePage and had 
a single String property called message.

Then I used cycle.getPage("AfterCreateUser") and setMessage to do it, 
and it seems to work okay.

The key part was remembering that you could get a page before you 
actually went there, which is exactly what your code does as well.

I'll try to give myself a little longer before posting next time. :-)

Todd

On Mar 14, 2004, at 7:54 AM, Petter Måhlén wrote:

> Either through the Visit instance or something like this (this is a
> DirectLink listener method of mine):
>
>   public void editTask(IRequestCycle requestCycle) {
>     logger.debug("editTask called");
>
>     EditTaskPage nextPage = (EditTaskPage) 
> requestCycle.getPage("EditTask")
> ;
>     Object[] parameters = requestCycle.getServiceParameters();
>     Integer  taskId     = (Integer) parameters[0];
>
>     Task t = new Task(taskId.intValue());
>
>     nextPage.setTask(t);
>     requestCycle.activate(nextPage) ;
>   }
>
> The EditTaskPage class has an abstract setTask method and the page
> specification (EditTask.page) contains the following:
>
>   <property-specification name="task"
> type="se.elevance.timer.data.Task" persistent="yes" 
> initial-value="null" />
>
> HTH,
>
> / Petter
>
>> -----Original Message-----
>> From: Todd O'Bryan [mailto:toddobryan@mac.com]
>> Sent: den 14 mars 2004 13:49
>> To: Tapestry users
>> Subject: passing message to a new page
>>
>>
>> I've finally got a Tapestry application doing stuff. I have a Login
>> page, a Main Menu, and a Create User page that actually inserts users
>> into a database and includes a PropertySelection drop-down
>> menu that I
>> created from a Hibernate PersistentEnum class. (BTW, does
>> anybody have
>> something ready-made to connect PersistentEnums to PropertySelections
>> since it seems that would be a common thing to do?)
>>
>> Here's my real question. After someone creates a new user,
>> I'd like to
>> put up a page saying that the user was added correctly, and then give
>> options of going back to the Main Menu or to create another user. How
>> can I pass a message to this new page that gives the user info if
>> successful, or has an error if not?
>>
>> Todd
>>
>>
>> ---------------------------------------------------------------------
>> 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
>


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


RE: passing message to a new page

Posted by Petter Måhlén <pe...@elevance.se>.
Either through the Visit instance or something like this (this is a
DirectLink listener method of mine):

  public void editTask(IRequestCycle requestCycle) {
    logger.debug("editTask called");
    
    EditTaskPage nextPage = (EditTaskPage) requestCycle.getPage("EditTask")
;
    Object[] parameters = requestCycle.getServiceParameters();
    Integer  taskId     = (Integer) parameters[0];

    Task t = new Task(taskId.intValue());
    
    nextPage.setTask(t);
    requestCycle.activate(nextPage) ;
  }

The EditTaskPage class has an abstract setTask method and the page
specification (EditTask.page) contains the following:

  <property-specification name="task"
type="se.elevance.timer.data.Task" persistent="yes" initial-value="null" />

HTH,

/ Petter

> -----Original Message-----
> From: Todd O'Bryan [mailto:toddobryan@mac.com] 
> Sent: den 14 mars 2004 13:49
> To: Tapestry users
> Subject: passing message to a new page
> 
> 
> I've finally got a Tapestry application doing stuff. I have a Login 
> page, a Main Menu, and a Create User page that actually inserts users 
> into a database and includes a PropertySelection drop-down 
> menu that I 
> created from a Hibernate PersistentEnum class. (BTW, does 
> anybody have 
> something ready-made to connect PersistentEnums to PropertySelections 
> since it seems that would be a common thing to do?)
> 
> Here's my real question. After someone creates a new user, 
> I'd like to 
> put up a page saying that the user was added correctly, and then give 
> options of going back to the Main Menu or to create another user. How 
> can I pass a message to this new page that gives the user info if 
> successful, or has an error if not?
> 
> Todd
> 
> 
> ---------------------------------------------------------------------
> 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