You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by lixin chu <li...@yahoo.com> on 2004/10/13 02:59:44 UTC

need advice: session scoped objects or session scoped ActionForm ?

Hi,
I am seeking your expert advice:
I have a simple page with Done and Cancel buttons. If
any of these buttons are clicked, I suppose to go back
to the calling page - there are a few pages that will
come to this page. It is a simple workflow type of
thing. 
So I need to know the retutn URL, pls some other
stuff.

The question is, where do I keep the return URL which
is passed in as request attribute ? 

Since the current page has some other buttons not just
Done and Cancel, I use LookupDispatchAction, that
means I have to keep the return URL in the session.
Which one is a better solution: keeping it in the
session scoped ActionForm or
request.getSession().setAttribute ? 

It is easier to manage the return URL if put into
ActionForm becuase it is isolated, no naming
conflict-bur ActionForm is for UI components only;
otherwise, I need to keep it in the session using a
name reference something like myAction_returnURL, and
also I need to handle the cleaning - it is still
possible that the sting is kept in the session until
the session is closed if the user does not click Done
or Cancel.

any best practice ? may be the best is to avoid using
session scope objects but I just can not think of a
way out for my use case.

thanks in advance
LX




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: need advice: session scoped objects or session scoped ActionForm ?

Posted by lixin chu <li...@yahoo.com>.
actually I do not like either option. my understanding
is:
* session scoped obejcts (I mean those put into the
session using request.getSession().setAttribute()) are
like global variables. I need to take care of
potential naming conflict-but I can not use fully
qualified domain name type of naming convention
because some tags resever the '.'; clean them when no
longer used - but there are chances that they are not
cleaned if the user does not click Done or Cancel but
jump to other pages by select menu items; 

* session scoped ActionForm should not be used to keep
application data but only UI related stuff

The other possible solution is to use Workflow
extenstion but I feel that it is not flexible enough.
And in fact workflow extension keeps data in the
session also so fundamentally no difference.

I guess it is the limitation of the current J2EE
implementation. 

Looks like I will choose to use
request.getSession().setAttribute way of keeping some
necessary data to support those use cases.




		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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


Re: need advice: session scoped objects or session scoped ActionForm ?

Posted by Sebastian Ho <se...@bii.a-star.edu.sg>.
For every calling page, use a new mapping in yr struts-config.

I assume u mean setting the action as session scope in yr config? They
are the same I think, the important thing is to keep it to one solution
and use it thoughout the application. Else it will be confusing and hard
to debug as yr application grows.

Sebastian


On Wed, 2004-10-13 at 08:59, lixin chu wrote:
> Hi,
> I am seeking your expert advice:
> I have a simple page with Done and Cancel buttons. If
> any of these buttons are clicked, I suppose to go back
> to the calling page - there are a few pages that will
> come to this page. It is a simple workflow type of
> thing. 
> So I need to know the retutn URL, pls some other
> stuff.
> 
> The question is, where do I keep the return URL which
> is passed in as request attribute ? 
> 
> Since the current page has some other buttons not just
> Done and Cancel, I use LookupDispatchAction, that
> means I have to keep the return URL in the session.
> Which one is a better solution: keeping it in the
> session scoped ActionForm or
> request.getSession().setAttribute ? 
> 
> It is easier to manage the return URL if put into
> ActionForm becuase it is isolated, no naming
> conflict-bur ActionForm is for UI components only;
> otherwise, I need to keep it in the session using a
> name reference something like myAction_returnURL, and
> also I need to handle the cleaning - it is still
> possible that the sting is kept in the session until
> the session is closed if the user does not click Done
> or Cancel.
> 
> any best practice ? may be the best is to avoid using
> session scope objects but I just can not think of a
> way out for my use case.
> 
> thanks in advance
> LX
> 
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com
> 
> ---------------------------------------------------------------------
> 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