You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Az Madu <az...@gmail.com> on 2012/03/14 23:04:14 UTC

Capturing user input data

Hi guys,

I have a query about how to capture data from a tml page and pass it back
into it's corresponding java file so that it can be processed and displayed
on another new page (or even on the same page after redrawing the same
page).

I have 2 pages currently, Page1.java and Page2.java where Page1 sets up
some information and passes it to Page2 by way of a service that I've
created for an external application in the AppModule.  Page1 simply has an
onActionFromStart method with a link that returns Page2 and on Page2 I
display an authentication dialog (username/password) inside an iFrame in
the page2.tml created by the service created in AppModule.

Now what I want to know how to do is to capture the users' 'username' so
that I can store it in a field on Page2.java and then pass it to a new page
(Page3.java) to indicate to the user that they have successfully
authenticated by displaying the username they entered and their sessionid.

On my Page2 do I make use of RequestGlobals (can I get such information
from this) or do I make use of any other classes in the Tapestry library
that I'm not aware of.  I'm still relatively new to how it all works and
I've managed to pass data to my tml pages (thanks to Thiago for earlier
assistance) but now I need a return ticket so to speak :-).

So my questions are:

1 - Can I capture data input (a username) from a tml page and pass it back
into the .java file bearing in mind I don't know the name of the field into
which the username is being entered, only that it is inside an iFrame
object.
2 - How do I extract this information along with any other that I may want
and display it on a new page (Page3.java).  Since I have no links to click
how would this captured data result in the creating of Page3.java?  Could I
use :

public class Page2{

@InjectPage private Page3 page3

@SessionAttribute
private String userName

Object onSomeMethodName(){ //how would this be called, should I use
onPassivate()?
page3.initialise(userName, sessionid); //for example
return page3;
}
}

I've asked many question so I'm grateful for any assistance from Tapestry
users.

Regards

Az

Re: Capturing user input data

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, 14 Mar 2012 19:04:14 -0300, Az Madu <az...@gmail.com> wrote:

> Hi guys,

Hi!

The "capture user input data" is basically JavaScript. Search the mailing  
list archives for sending data from JavaScript to Java and you'll find at  
least some examples.

Regarding passing information from one page to another, read the  
navigation part of the documentation.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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