Re: Initializing contextdata automatically in struts/jsp

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Feb 05 2003 - 17:53:39 EST

  • Next message: Vincent Stoessel: "CayenneRuntimeException"

    Yes, you probably should. Also I would recommend to use
    org.objectstyle.cayenne.conf.ServletConfiguration.DATA_CONTEXT_KEY instead
    of String value "cayenne.datacontext" to make it more type-safe.

    Andrus

    >>
    >>
    >> You preserved these lines in your web.xml, right?
    >> <listener>
    >> <listener-class>webtest.CustomConfiguration</listener-class>
    >> </listener>
    >>
    >> If so, DataContext is created by CustomConfiguration's superclass when
    >> the session is staryed. But the key to retrieve it is defined under
    >> ServletConfiguration.DATA_CONTEXT_KEY as "cayenne.datacontext". Try
    >> using this key instead. Or use
    >> CustomConfiguration.getDefaultContext().
    >>
    >> Let me know if this works. In the meantime I will see if tutorial code
    >> needs to be fixed.
    >>
    >> Andrus
    >>
    >>
    >
    > Now that things are working I can go back to using
    >
    > this :
    > web.xml:
    >
    >
    > <listener>
    > <listener-class>webtest.CustomConfiguration</listener-class>
    > </listener>
    >
    > and this in my action classes:
    >
    > DataContext ctxt = (DataContext)
    > request.getSession().getAttribute("cayenne.datacontext");
    >
    >
    >
    > so I won't have to initialize the session in index.html.
    >
    > Right?
    >
    > --
    > Vincent Stoessel
    > Linux Systems Developer
    > vincent xaymaca.com



    This archive was generated by hypermail 2.0.0 : Wed Feb 05 2003 - 17:53:39 EST