struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: HttpSession initialisation
Date Mon, 01 Jul 2002 17:39:34 GMT


On Mon, 1 Jul 2002, Heligon Sandra wrote:

> Date: Mon, 1 Jul 2002 18:58:07 +0200
> From: Heligon Sandra <Sandra.Heligon@nextream.fr>
> Reply-To: Struts Users Mailing List <struts-user@jakarta.apache.org>
> To: "'struts-user@jakarta.apache.org'" <struts-user@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:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>
>
>


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


Mime
View raw message