Try providing a custom validation tracker to form.
Form creates one that is stored in the session by default.
I suspect this is where your session creation is coming from.

Note that for validation to work properly, you'll have to persist the tracker in some form.

Robert

On Mar 9, 2009, at 3/97:07 PM , Borut Bolčina wrote:

Hi,

I am trying to prevent session creation when using forms and in general. I searched the mailing list but can not explain why the session is still being
created. I use 5.0.18.

Index.tml

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
   <body>
       <t:form t:id="myform">
           <t:label for="cardNumber"/>:
<t:textfield t:id="cardNumber" value="cardNumber" size="20"/>
           <input type="submit" value="Submit"/>
       </t:form>
       <div>${cardNumber}</div>
   </body>
</html>

Index.java

@Meta("tapestry.persistence-strategy=client")
public class Index {

   @Property
   @Persist
   private String cardNumber;

}

Even when I remove the @Persist annotation from the cardNumber property, the session is still being created. Until I remove the Form from the template.

I am monitoring session creation with a class in my same test project:

package bb.test.session;
import java.util.Date;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

public class MyHttpSessionListener implements HttpSessionListener {
   public void sessionCreated(HttpSessionEvent se)
   {
       HttpSession session = se.getSession();
       System.out.print(getTime() + " (session) Created:");
System.out.println("ID=" + session.getId() + " MaxInactiveInterval="
+ session.getMaxInactiveInterval());
   }
   public void sessionDestroyed(HttpSessionEvent se)
   {
       HttpSession session = se.getSession();
// session has been invalidated and all session data (except Id)is
no longer available
       System.out.println(getTime() + " (session) Destroyed:ID=" +
session.getId());
   }
   private String getTime()
   {
       return new Date(System.currentTimeMillis()).toString();
   }

}

and with

   <listener>

<listener-class>bb.test.session.MyHttpSessionListener</listener-class>
   </listener>

in my web.xml.

Of course Firefox extension FireCookie is of help.

So, is this a bug?

Regards,
Borut


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to