You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by andy wix <st...@hotmail.com> on 2005/05/31 18:28:27 UTC

Have state across 2 requests without use of session?

Hi,

I am having difficulty trying to write a web app without session state (not 
my choice).

As an example, my normal approach, say, to delete a user from a list is:

in the 'pre display' action:
- fill an arraylist of user objects from the db and set it in the session

in the jsp
- this arraylist is used for the values in a drop down menu
- user selects one item, and through using JSTL, I get the object's uid

in the 'post display' action:
- look up the uid of the object in the arraylist
- delete user on db (specifying uid)

Is there a way of doing this using forms or something?  The issue is that if 
I put the arraylist in the request it is no longer in scope when I get to 
the post display action.

Thanks,
andy

_________________________________________________________________
Winks & nudges are here - download MSN Messenger 7.0 today! 
http://messenger.msn.co.uk


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


Re: Have state across 2 requests without use of session?

Posted by Ed Griebel <ed...@gmail.com>.
Here's a couple of ideas:
- You can use the same form bean in all 3 pages, using <html:hidden>
fields for data that doesn't need to be displayed but needs to be
passed along.
- You can create a <html:submit> button which is populated via data
from a form bean property specified with the property= attribute
- There's always the fallback (rhymes with "hack") of using javascript
on the page to create a button/link with all the arguments required as
parameters to a GET method.

With all these ideas you're limited to the amount of data to "store"
in the request. So, couple whatever solution you come up with for
above with some data-layer caching (like what iBatis provides) to
eliminate your requirement to manually cache the user objects.

HTH,
-ed

On 5/31/05, andy wix <st...@hotmail.com> wrote:
> Hi,
> 
> I am having difficulty trying to write a web app without session state (not
> my choice).
> 
> As an example, my normal approach, say, to delete a user from a list is:
> 
> in the 'pre display' action:
> - fill an arraylist of user objects from the db and set it in the session
> 
> in the jsp
> - this arraylist is used for the values in a drop down menu
> - user selects one item, and through using JSTL, I get the object's uid
> 
> in the 'post display' action:
> - look up the uid of the object in the arraylist
> - delete user on db (specifying uid)
> 
> Is there a way of doing this using forms or something?  The issue is that if
> I put the arraylist in the request it is no longer in scope when I get to
> the post display action.
> 
> Thanks,
> andy
> 
> _________________________________________________________________
> Winks & nudges are here - download MSN Messenger 7.0 today!
> http://messenger.msn.co.uk
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

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


Re: Have state across 2 requests without use of session?

Posted by Dave Newton <ne...@pingsite.com>.
Martin Gainty wrote:

> You can use a session-scoped bean coded within your Action class such as

[...]

> [Original subject line:] Subject: Have state across 2 requests without 
> use of session?

Uh...

Dave



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


Re: Have state across 2 requests without use of session?

Posted by Martin Gainty <mg...@hotmail.com>.
Andy-

You can use a session-scoped bean coded within your Action class such as
 User user = ... look up valid user in the database ...;
    HttpSession session = request.getSession();
    session.setAttribute("user", user);
http://struts.apache.org/api/org/apache/struts/taglib/bean/package-summary.html#doc.Creation

HTH,
Martin-
P.S.
Who is Stix Wix?
----- Original Message ----- 
From: "andy wix" <st...@hotmail.com>
To: <us...@struts.apache.org>
Sent: Tuesday, May 31, 2005 12:28 PM
Subject: Have state across 2 requests without use of session?


> Hi,
>
> I am having difficulty trying to write a web app without session state 
> (not my choice).
>
> As an example, my normal approach, say, to delete a user from a list is:
>
> in the 'pre display' action:
> - fill an arraylist of user objects from the db and set it in the session
>
> in the jsp
> - this arraylist is used for the values in a drop down menu
> - user selects one item, and through using JSTL, I get the object's uid
>
> in the 'post display' action:
> - look up the uid of the object in the arraylist
> - delete user on db (specifying uid)
>
> Is there a way of doing this using forms or something?  The issue is that 
> if I put the arraylist in the request it is no longer in scope when I get 
> to the post display action.
>
> Thanks,
> andy
>
> _________________________________________________________________
> Winks & nudges are here - download MSN Messenger 7.0 today! 
> http://messenger.msn.co.uk
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> 

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