RE: Struts and Sessions Problem

2005-06-29 Thread Scott Piker
As Michael alluded to in his response, a session will be created when
the user hits index.jsp unless you explicitly specify session=false in
the page directive.  (See
http://java.sun.com/products/jsp/syntax/2.0/syntaxref2010.html#15653)
That's probably what's going on here.

- Scott

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, June 29, 2005 12:04 PM
 To: user@struts.apache.org
 Subject: Struts and Sessions Problem
 
 Hello all!
 
 I have a problem with struts and sessions, perhaps someone 
 has an idea:
 
 My web.xml contains the following welcome file list:
 
 welcome-file-list
   welcome-fileindex.jsp/welcome-file
 /welcome-file-list
 
 My index.jsp only forwards like this:
 
 %@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic % html
   body
 logic:forward name=cookiecheck/
   /body
 /html
 
 My struts-config uses a global forward to map it like this:
 
 global-forwards
   forward name=cookiecheck path=/checkcookies.do 
 redirect=false/
 
 /global-forwards
 
 In the struts-config the final mapping to the action is this one:
 
 action
   path=/checkcookies
   unknown=true 
   type=somepackage.CheckCookiesAction
   scope=request
   validate=false
   forward name=Failure path=/login.jsp redirect=false/
   forward name=Success path=/home.jsp redirect=false/ 
 /action
 
 In CheckCookiesAction which extends Action, in the 
 execute(...) method I get the HTTPSession like this:
 
 HttpSession session = request.getSession( false ) );
 
 My problem: when a user accesses my webapp for the first time 
 this method does not return null, although it should do so! 
 It is no problem of Tomcat 5.5.9 I am using, the Servlet I 
 wrote for testing does its work properly and returns null if 
 the user accesses my page for the first time. So why does 
 Struts behave like this? Is it because of all the forwarding 
 and redirecting, although it should have no effect in my opinion?
 
 Perhaps someone knows whats going wrong
 
 Peter
 
 --
 
 MATERNA GmbH Information  Communications Vosskuhle 37
 44141 Dortmund
 Tel:  +49-231-5599-8868
 Fax: +49-231-5599-678868
 
 [EMAIL PROTECTED]
 www.annyway.dewww.materna.de
 www.annyway.com  www.materna.com
 
 Visit us at the following events:
 ACI EUROPE, Munich
 June, 22 - 24, 2005
 
 ACI EUROPE, Verona
 September, 26 - 28, 2005
 
 CTIA Wireless I.T.  Entertainment 2005, San Francisco 
 September, 27 - 29, 2005
 
 Con4, Cologne
 September, 27 - 29, 2005
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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



Re: Struts and Sessions Problem

2005-06-29 Thread Ed Griebel
Is it possible that you have a servlet filter set up which creates a
session? Possibly one that checks if the user is logged in?

-ed

On 6/29/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hello again
 
 As Michael suggested I put a session=false in the page directive in my
 index.jsp like this
 
 %@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic %
 %@ page session=false %
 html
  body
 logic:forward name=cookiecheck/
  /body
 /html
 
 but the problem still is there. my session is not null!
 
 Peter
 -Ursprüngliche Nachricht-
 Von: Michael Jouravlev [mailto:[EMAIL PROTECTED]
 Gesendet: Mittwoch, 29. Juni 2005 18:16
 An: Struts Users Mailing List
 Betreff: Re: Struts and Sessions Problem
 
 
 Hmm, I don't see how the session can be null. If you start from JSP,
 and you did not set session=false in the page directive, then to my
 understanding, session should be created right in the JSP.
 
 Michael.
 
  My index.jsp only forwards like this:
 
  %@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic %
  html
body
  logic:forward name=cookiecheck/
/body
  /html
 
 [skipped]
 
  My problem: when a user accesses my webapp for the first time this method
  does not return null,
  although it should do so! It is no problem of Tomcat 5.5.9 I am using, the
  Servlet I wrote for testing does
  its work properly and returns null if the user accesses my page for the
  first time. So why does Struts behave
  like this? Is it because of all the forwarding and redirecting, although
 it
  should have no effect in my opinion?
 
  Perhaps someone knows whats going wrong
 
  Peter
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


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