Dumb Question but I have to ask
First from the doc for the method
public boolean isNew()Returns true if the client does not yet know about the session or if the client chooses not to join the session. For example, if the server used only cookie-based sessions, and the client had disabled the use of cookies, then a session would be new on each request.
   Returns:
true if the server has created a session, but the client has not yet joined
   Throws:
IllegalStateException - if this method is called on an already invalidated session

   protected boolean processPreProcess(request, response)
   {
   protected boolean continuedProcessing = true;
   try
   {
   if (request.getSession()==null)||(request.getSession().isNew() )
   {
    continueProcessing = false;
    response.sendredirect("/login.jsp");
   } //end if
   } //end try
   catch(IllegalStateException ill)
   {
out.println("IllegalStateException has been thrown the exception is "+ill.getMessage());
   }
   return continueProcessing;
   } //end method
a)are you checking to ensure the getSession is NOT NULL before the isNew test ? b)In this scenario is the session is null or session isNew then the method returns false are your returning true/false?
   c)are you catching the IllegalStateException ???

   Anyone else ?
   M-
----- Original Message ----- From: "Jim Reynolds" <[EMAIL PROTECTED]>
To: <user@struts.apache.org>
Sent: Monday, October 24, 2005 10:57 AM
Subject: Session Management Within Webapp 2 (jsessionid)s


I have a project which I am working on. It does not have any type of form
login. It is just a merchant-type site.

When client hits the URL, the index.jsp calls a forward like so:
<logic:forward name="welcome" />

This of course sends the request to the struts-config.do.

I extended the RequestProcessor to set up some session type beans that
control the site. I only create the beans if the session.isNew() returns
true. In the RequestProcessor, I can see the beans being created and set
into the session.

Finally the request is forward to a .jsp page from the original "welcome.do"
call.

On the jsp page, I have some tags, with links. Since I am using tags, I just
used some normal html style links. Not html:link calls.

When a user requests hits a link, and calls another xxx.do, the request goes
back to the RequestProcessor, and it thinks the session.isNew(), and I end
up creating all the session beans again.

After that it works as it should, but I end up with 2 (jsessionid) cookies
being created for each user?

I am seeking advice, as to why this occured, and if this is normal behavior,
or not-normal behavior. Upon researching the topic over the weekend, I was
unable to find any threads, about this.

Am I doing something wrong, or possibly a logic-flaw somewhere.

Thanks,

<user@struts.apache.org>

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

Reply via email to