Don't panic about session and cookies !

Session are used to maintain state in your application between 2 request
from user : HTTP is a non connected protocol, so you cannot know where your
user comes from where you perform a request.

Session is just a Collection of objects in memory associated whith an id
that servlet container maintain for you. User browser whith cookies
activated receives a cookie with this id so that the container is able to
link future request to the session collection associated with the user.
Without cookies, URL are expanded to add the id as a parameter of requests.

If you put objets in the request scope, after the JSP has produced the HTML
page the objects are destroyed ! Your user objet that MUST be retrieved in
other requests MUST be in the stored session scope.

> Hi all,
>
> I'm very newbie with struts and java. I'm developing an application anf I
> don't like to use cookies or session objects.
>
> Focusing in the struts example, the user is in the session. Why not set
this
> object in the request parameter in all the actions and jsps??
>
> ActionClass
> //Code
> request.setParameter("user", user);
> //more code
>
> Jsp
> //Code
> <%
> pageContext.setParameter("user", user);
> %>
> //more code
>
>
> Is this a good practice??
>
> Is there another ways to do it??
>
> Regards, Enrique.
>
>
> _____________________________
> Enrique Rodriguez Lasterra
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to