cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Neary <dave.ne...@palamon.ie>
Subject Passing document, request & resonse to other methods
Date Mon, 01 Oct 2001 11:30:13 GMT

Hi all,

Yet again, this may come across as a silly question, but it's kind of a
question on "best practice" - is it considered acceptable to pass
document & request to methods like I've done below? If it is, is it
better to return an element, or append that element to document
directly? Here's the example code (just a hello world).

Apologies if these posts seem silly, I just want to make sure I'm not
abusing xsp at this stage, so that later on my code will look a bit
better & be easier to maintain (hopefully).

<xsp:page language="java"
xmlns:xsp="http://www.apache.org/1999/XSP/Core">

  <xsp:logic>
    Node hello1(Document document, HttpServletRequest request)
    {
       Node n = document.createTextNode("Hello, world!\n");

       return n;
    }
    
    void hello2(Document document, HttpServletRequest request)
    {
       Node n = document.createTextNode("Hello, world!\n");
       document.getDocumentElement().appendChild(n);

       return;
    }
  </xsp:logic>

  <page>
    <!-- One of these two is better... or are they both equally bad? -->
    <xsp:logic>hello2(document, request);</xsp:logic>
    <xsp:expr>hello1(document, request)</xsp:expr>
  </page>
</xsp:page>

Cheers,
Dave.

-- 
David Neary,               E-Mail dave.neary@palamon.ie
Palamon Technologies Ltd.  Phone +353-1-634-5059

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message