Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Struts & Session Creation

Options
  • 27-04-2005 11:10pm
    #1
    Registered Users Posts: 147 ✭✭


    Hey,

    Ripping my hair out on this one, I have a website that I want to try and minmise the amount of sessions created on it.

    I have the below jsp and when it is loaded it creates a session? Does anyone know if there is a particular taglib that creates a session?

    Thanks

    SG

    <%@ page session="false"%>
    <%@ taglib uri="http://java.sun.com/jstl/core&quot; prefix="c"%>
    <%@ taglib uri="http://struts.apache.org/tags-html&quot; prefix="html"%>
    <%@ taglib uri="http://struts.apache.org/tags-logic&quot; prefix="logic"%>
    <%@ taglib uri="http://struts.apache.org/tags-bean&quot; prefix="bean"%>
    <logic:messagesPresent>
    <span id="errorsHeader">
    <bean:message key="errors.validation.header"/>
    </span>
    <html:messages id="error">
    <li><c:out value="${error}"/></li>
    </html:messages>
    <hr />
    </logic:messagesPresent>
    <html:form action="/login" focus="username">
    <html:text property="username"/>
    <br />
    <html:text property="password"/>
    <br />
    </html:form>


Comments

  • Closed Accounts Posts: 25 dan_pretty_boy


    Hi

    To find out I would implement a HttpSessionBindingListener and see what its being binded..from there u can determine what variable is being added to the session



    regards
    Danny


  • Registered Users Posts: 147 ✭✭seagizmo


    Hi

    To find out I would implement a HttpSessionBindingListener and see what its being binded..from there u can determine what variable is being added to the session
    regards
    Danny

    Danny,

    I've the following two listeners defined, however without any object being added to the session, it seems that one is created even with a session="false" directive in the jsp.....

    Is there anyway to see what page is creating the session?

    SG

    public class SessionAttributeListener implements HttpSessionAttributeListener {

    protected org.apache.log4j.Logger log = org.apache.log4j.LogManager.getLogger("listeners");

    public void attributeAdded(HttpSessionBindingEvent e) {
    log.debug(e.getSession().getId()+" added "+e.getName()+","+e.getValue().toString());
    }

    public void attributeRemoved(HttpSessionBindingEvent e) {
    log.debug(e.getSession().getId()+" removed "+e.getName()+","+e.getValue().toString());
    }

    public void attributeReplaced(HttpSessionBindingEvent e) {
    log.debug(e.getSession().getId()+" replaced "+e.getName()+","+e.getValue().toString());
    }
    }

    public class SessionListener implements HttpSessionListener {

    protected org.apache.log4j.Logger log = org.apache.log4j.LogManager.getLogger("listeners");

    public void sessionCreated(HttpSessionEvent e) {
    log.debug(e.getSession().getId() + " created ");
    }

    public void sessionDestroyed(HttpSessionEvent e) {
    log.debug(e.getSession().getId() + " destroyed");
    }
    }


  • Closed Accounts Posts: 25 dan_pretty_boy


    Hi,


    Does

    public void sessionCreated(HttpSessionEvent e) {
    log.debug(e.getSession().getId() + " created ");
    }


    print out anything??


  • Registered Users Posts: 147 ✭✭seagizmo


    Hi,


    Does

    public void sessionCreated(HttpSessionEvent e) {
    log.debug(e.getSession().getId() + " created ");
    }


    print out anything??

    Just that a session has been created but no indication from where!!!

    SG


Advertisement