You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jason Cox <ja...@myway.com> on 2003/11/12 05:20:10 UTC

Passing parameters without visit object?

I'm sure this is simple, but I'm having trouble tying the documentation together on how to go about this.

I am writing the content management piece for our web app now. I need the visit object to represent the user. Basically, who is logged in and what their access level is.

However, nearly every page is a form. Each form takes different information and slams it into the database.

All of the examples I have seen says to use a visit object to transfer information from the page into the .java represenation of the page. However, that's not really an option unless I want a really huge do-it-all visit object.

Can I have multiple classes represent the visit object? 

_______________________________________________
No banners. No pop-ups. No kidding.
Introducing My Way - http://www.myway.com

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


Re: Passing parameters without visit object?

Posted by Harish Krishnaswamy <hk...@comcast.net>.
Not sure what the question here is, but if you are looking for a way to pass objects from one page 
to another without using the Visit, there is a way.

Page1.java

public void submit(IRequestCycle cycle)
{
	...
	Page2 nextPage = (Page2) cycle.getPage("Page2");
	nextPage.setYourObject(this.yourObject);
	cycle.activate(nextPage);
	...
}

-Harish

Jason Cox wrote:

> I'm sure this is simple, but I'm having trouble tying the documentation together on how to go about this.
> 
> 
> 
> I am writing the content management piece for our web app now. I need the visit object to represent the user. Basically, who is logged in and what their access level is.
> 
> 
> 
> However, nearly every page is a form. Each form takes different information and slams it into the database.
> 
> 
> 
> All of the examples I have seen says to use a visit object to transfer information from the page into the .java represenation of the page. However, that's not really an option unless I want a really huge do-it-all visit object.
> 
> 
> 
> Can I have multiple classes represent the visit object? 
> 
> _______________________________________________
> No banners. No pop-ups. No kidding.
> Introducing My Way - http://www.myway.com
> 
> ---------------------------------------------------------------------
> 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 parameters without visit object?

Posted by Luke Renn <lu...@imapmail.org>.
You don't have to use the visit object.  Infact, don't use the visit 
object at all until its absolutely necessary (they log in).  Goto the 
tapestry documentation page.  Click on the Tapestry Component 
reference.  Then click on "Form".  Now, that example does use the visit 
object, but thats because the login info is needed in the visit (as you 
already know).  Now look at the text area component.  That example does 
not use the visit object and is more what you are looking for.  It would 
work the same way with a text field or anything else in a form.  You 
could also look at the RadioGroup or Checkbox example.  Someone will 
give a better explaination, but that should get you going.

Jason Cox wrote:

>I'm sure this is simple, but I'm having trouble tying the documentation together on how to go about this.
>
>I am writing the content management piece for our web app now. I need the visit object to represent the user. Basically, who is logged in and what their access level is.
>
>However, nearly every page is a form. Each form takes different information and slams it into the database.
>
>All of the examples I have seen says to use a visit object to transfer information from the page into the .java represenation of the page. However, that's not really an option unless I want a really huge do-it-all visit object.
>
>Can I have multiple classes represent the visit object? 
>
>_______________________________________________
>No banners. No pop-ups. No kidding.
>Introducing My Way - http://www.myway.com
>
>---------------------------------------------------------------------
>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 parameters without visit object?

Posted by Bryan Lewis <br...@maine.rr.com>.
Maybe I'm missing the question, but... I'm working on apps like that,
where every page is a form.  And you're right, you don't want to load up
the visit object.  I keep as little as possible there -- the user's
identity and an occasional large list of data objects when
page-batching.  (I'd like to find an easy way to avoid the latter, but I
digress.)  In fact I don't use any custom Visit class; I'm content with
the default HashMap.

Why not do the "slamming into the database" in each page's code at
submit time?

    public void formSubmit(IRequestCycle cycle) {
        //... skipping over the validation and so on
        businessDelegate.setData(dataObject);
    }

The setData() call passes the dataObject to the back-end persistence
layer (for me an EJB).  The dataObject is nicely populated directly by
the form components so it's ready to go by the time formSubmit() is
invoked.

I always thought the frequent use of the Visit object in the examples
was to keep the examples simple and to avoid the need for a persistence
engine on every one.


----- Original Message ----- 
From: "Jason Cox" <ja...@myway.com>
To: <ta...@jakarta.apache.org>
Sent: Tuesday, November 11, 2003 11:20 PM
Subject: Passing parameters without visit object?


>
> I'm sure this is simple, but I'm having trouble tying the
documentation together on how to go about this.
>
>
>
> I am writing the content management piece for our web app now. I need
the visit object to represent the user. Basically, who is logged in and
what their access level is.
>
>
>
> However, nearly every page is a form. Each form takes different
information and slams it into the database.
>
>
>
> All of the examples I have seen says to use a visit object to transfer
information from the page into the .java represenation of the page.
However, that's not really an option unless I want a really huge
do-it-all visit object.
>
>
>
> Can I have multiple classes represent the visit object?
>
> _______________________________________________
> No banners. No pop-ups. No kidding.
> Introducing My Way - http://www.myway.com
>
> ---------------------------------------------------------------------
> 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