cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: populateDocument global variables
Date Fri, 27 Apr 2001 16:42:23 GMT


I assume you mean you want to add in some variables and code near the top
of the populateDocument() method, before any of your regular XSP code.  The
only way I know to do this is with a taglib.  I've seen a couple of
different approaches in the taglibs that come with Cocoon, but we are using
this template in our logicsheets to put code in near the top of populate
document (I think this example is similar to what you want):

<xsl:template match="xsp:page/*[not(starts-with(name(.), 'xsp:'))]">
  <xsl:apply-templates select="@*"/>
        HttpSession     swiftUserSession        = request.getSession();
        String          swiftLoginName          = (String) swiftUserSession.getAttribute("loginName");

To make the request.getSession() have a true parameter, add in the
create-session="true" attribute to the <xsp:page> element in your xml.


Subject:  populateDocument global variables

Hi everyone, I want to add to the "populateDocument" method, some
global variables:

       public void populateDocument(
         HttpServletRequest request,
         HttpServletResponse response,
         Document document
         throws Exception
         Node xspParentNode = null;
         Node xspCurrentNode = document;
         Stack xspNodeStack = new Stack();
         HttpSession session = request.getSession(false);

         There I want to add something like that:

                        int id_from = ((Integer)session.getAttribute
                        int id_count = ((Integer)session.getAttribute
                        String language = (String)session.getAttribute

     And I also want the "getSession" to have true parameter.

Can anybody tell me if it is possible to do this, and if how to do it?
(The purpose is to read parameters before the document is build)
Thank you for your help!

Please check that your question has not already been answered in the
FAQ before posting. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message