You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Heligon Sandra <Sa...@nextream.fr> on 2002/07/01 18:58:07 UTC
HttpSession initialisation
Hi,
Sorry to question about this newbie point but I don't find answer in
the Struts documentation.
I don't understand how the sessions are created in Struts ?
Which component is responsible of this task ? I think that it is
the controller but each application has to program it with a
getSession(true/false) or is it an automatic process ?
Where the session creation must be done ?
If I have a form login/logout in my application, the Action
associated to
this page must do the session creation, isn't it ?
Action example:
Execute(){
// Ask Login to a desktop authentication server
// Create Session, is it possible to set the session
identifier
// to associate it to a database index for instance
// Where the session is stored?
}
After for each request I can test the HttpSession in the method of
the RequestProcessor.
If the application controls the session creation (in a execute()
action method)
what is the interest in sessionCreate() method in the
HttpSessionListener ?
For the delete, the session is destroyed automatically after the
timeout.
Is the timeout configurable in a properties file ?
Thanks a lot for you help
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: HttpSession initialisation
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Mon, 1 Jul 2002, Heligon Sandra wrote:
> Date: Mon, 1 Jul 2002 18:58:07 +0200
> From: Heligon Sandra <Sa...@nextream.fr>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: "'struts-user@jakarta.apache.org'" <st...@jakarta.apache.org>
> Subject: HttpSession initialisation
>
>
> Hi,
>
> Sorry to question about this newbie point but I don't find answer in
> the Struts documentation.
> I don't understand how the sessions are created in Struts ?
>
> Which component is responsible of this task ? I think that it is
> the controller but each application has to program it with a
> getSession(true/false) or is it an automatic process ?
> Where the session creation must be done ?
> If I have a form login/logout in my application, the Action
> associated to
> this page must do the session creation, isn't it ?
>
>
That's actually an interesting question, and there is more than one
possible answer:
* The controller servlet will create a session for you, if you
declare that your form bean is in session scope.
* The controller servlet will create a session for you, if you
configured the automatic locale recognition mechanism (the "locale"
servlet initialization parameter for 1.0, or the corresponding
attribute on the <controller> element for 1.1).
* Your application Action can create a session if it needs to, by
calling request.getSession().
* Actions will create a session for you automatically if you use
transaction tokens, or the getLocale()/setLocale() methods.
* JSP pages will create a session for you automatically unless you
explicitly tell them not to (<%@ page ... session="false" ... %>).
* The <html:html> tag will create a session for you automatically
if you use locale="true".
* The <html:form> tag will create a session for you automatically
if your form bean is in request scope, or if you are using
transaction tokens.
Craig
> Action example:
> Execute(){
> // Ask Login to a desktop authentication server
> // Create Session, is it possible to set the session
> identifier
> // to associate it to a database index for instance
> // Where the session is stored?
> }
>
> After for each request I can test the HttpSession in the method of
> the RequestProcessor.
>
> If the application controls the session creation (in a execute()
> action method)
> what is the interest in sessionCreate() method in the
> HttpSessionListener ?
>
> For the delete, the session is destroyed automatically after the
> timeout.
> Is the timeout configurable in a properties file ?
>
>
> Thanks a lot for you help
>
>
>
>
> --
> 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>