You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Struts Newsgroup (@Basebeans.com)" <st...@basebeans.com> on 2002/04/03 16:55:01 UTC

storing data beyond single page scope without commiting to database

Subject: storing data beyond single page scope without commiting to database
From: Simon Kirk <si...@perceptionbe.com>
 ===
Hello all,
I have a system where I am creating an object with a certain amount of 
data, let's call it object A. It references to one or more object Bs that 
can be said to 'belong' to it. Let's say that there are not any object Bs 
that fit the criteria of what I want, so in my form to input an object A, I 
have a button to add an object B to go with it.

What I could do is when I click the button to create a new 
object B, I submit the data so far entered for object A and store the data 
in a database. I then enter my data for object B, submit, and get taken 
back to object A where my form entries are restored, together with the new 
object B in, say, a drop down list. However this raises the problem that 
the data for the incomplete object A could become available to other users 
unless I put in an 'active' flag or something like it so that until I 
finally submit the data for object A other users can't see it.

What I would *like* to do is store the data for object A in the form bean 
for it and retrieve it later on after creating object B. This seems to be 
an issue of scope. I feel this is probably something people have done a lot 
before, but I can't find anything that concisely and clearly explains it on 
the struts website. Can anybody suggest something, or point me in the 
direction of things to read?

Incidentally, I suppose one way around it would be to maintain a database 
connection and only commit my changes for the object A on completion of 
submission for both A and B, but I'm using a database connection pool 
anyway which would negate this, no?

Many thanks for any help.
Simon

-- 
Simon Kirk
perception|be.developer(java)
t. +44 (0) 20 7689 1200

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: storing data beyond single page scope without commiting to database

Posted by "Karim D. Saloojee" <kd...@yahoo.com>.
Hi

Note, I am a newbie.

Nonetheless, have you tried storing the form-bean for Object A in the
session (struts-config)? Then in another action say ten screens down the
line you can retrieve it from the session and work with it there.  Once you
are finished, you can remove it from the session if you want.

-----Original Message-----
From: Struts Newsgroup [mailto:@Basebeans.comstruts@basebeans.com]
Sent: 03 April 2002 16:55
To: struts-user@jakarta.apache.org
Subject: storing data beyond single page scope without commiting to
database


Subject: storing data beyond single page scope without commiting to database
From: Simon Kirk <si...@perceptionbe.com>
 ===
Hello all,
I have a system where I am creating an object with a certain amount of
data, let's call it object A. It references to one or more object Bs that
can be said to 'belong' to it. Let's say that there are not any object Bs
that fit the criteria of what I want, so in my form to input an object A, I
have a button to add an object B to go with it.

What I could do is when I click the button to create a new
object B, I submit the data so far entered for object A and store the data
in a database. I then enter my data for object B, submit, and get taken
back to object A where my form entries are restored, together with the new
object B in, say, a drop down list. However this raises the problem that
the data for the incomplete object A could become available to other users
unless I put in an 'active' flag or something like it so that until I
finally submit the data for object A other users can't see it.

What I would *like* to do is store the data for object A in the form bean
for it and retrieve it later on after creating object B. This seems to be
an issue of scope. I feel this is probably something people have done a lot
before, but I can't find anything that concisely and clearly explains it on
the struts website. Can anybody suggest something, or point me in the
direction of things to read?

Incidentally, I suppose one way around it would be to maintain a database
connection and only commit my changes for the object A on completion of
submission for both A and B, but I'm using a database connection pool
anyway which would negate this, no?

Many thanks for any help.
Simon

--
Simon Kirk
perception|be.developer(java)
t. +44 (0) 20 7689 1200

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: storing data beyond single page scope without commiting to database

Posted by "Wellie W. Chao" <wc...@caraveltech.com>.
Why don't you store the temporary object in the session object and check to
see if the object exists when rendering the form?

-----Original Message-----
From: Struts Newsgroup [mailto:@Basebeans.comstruts@basebeans.com]
Sent: Wednesday, April 03, 2002 9:55 AM
To: struts-user@jakarta.apache.org
Subject: storing data beyond single page scope without commiting to
database


Subject: storing data beyond single page scope without commiting to database
From: Simon Kirk <si...@perceptionbe.com>
 ===
Hello all,
I have a system where I am creating an object with a certain amount of
data, let's call it object A. It references to one or more object Bs that
can be said to 'belong' to it. Let's say that there are not any object Bs
that fit the criteria of what I want, so in my form to input an object A, I
have a button to add an object B to go with it.

What I could do is when I click the button to create a new
object B, I submit the data so far entered for object A and store the data
in a database. I then enter my data for object B, submit, and get taken
back to object A where my form entries are restored, together with the new
object B in, say, a drop down list. However this raises the problem that
the data for the incomplete object A could become available to other users
unless I put in an 'active' flag or something like it so that until I
finally submit the data for object A other users can't see it.

What I would *like* to do is store the data for object A in the form bean
for it and retrieve it later on after creating object B. This seems to be
an issue of scope. I feel this is probably something people have done a lot
before, but I can't find anything that concisely and clearly explains it on
the struts website. Can anybody suggest something, or point me in the
direction of things to read?

Incidentally, I suppose one way around it would be to maintain a database
connection and only commit my changes for the object A on completion of
submission for both A and B, but I'm using a database connection pool
anyway which would negate this, no?

Many thanks for any help.
Simon

--
Simon Kirk
perception|be.developer(java)
t. +44 (0) 20 7689 1200

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>