Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Struts & Session Creation

  • 27-04-2005 11:10PM
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 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, Registered Users 2 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