Never mind -- I found where to look: in the request.xsl 
logicsheet in the cocoon.jar file.
And btw, it works! (I needed to use as="object" for the array case).

   Is there any documentation project going on? I'd like to 
consider helping out some. Things really aren't too hard to 
understand looking at the XSL but for the newcomer, it takes a 
while to find out where to start.

A.

On Friday, February 8, 2002, at 01:33 , Andre Thenot wrote:

> Hi,
>
> I've been playing around with setAttribute() in a java Action 
> class in the container, to set attributes accessible with <xsp-
> request:get-attribute.../> in an XSP. It works perfectly for 
> String objects.
>   But what I'm looking for is documentation that explains how 
> to pass more exotic stuff using attributes; all I have found is 
> the "Request Logicsheet" docs and the javadocs for 
> XSPRequestHelper (quite terse).
>   I'm trying to pass some array-like data (ie. a 2-dimensional 
> String[][]) or, ideally, some tree-like data (an XML 
> fragment?). So I tried putting XML markup in the Action class 
> like this:
>
> request.setAttribute("blocofstuff", 
> "<table><tr><td>a</td><td>b</td></tr><tr><td>1</td><td>2</td></tr></table>
> ");
>
> ...only to see it escaped, which I guess makes sense for most 
> cases. I noticed that there is an 'as="xml|node"' attribute to 
> the get-attribute tag, but the docs don't say much about it and 
> nothing came out when I used it; is this what I need to use? 
> (if so, how?)
>   I also tried passing a array of Strings like this:
>
> String aTable[][] = {{"a","b"},{"c","d"}};
> request.setAttribute("mytable", aTable);
>
> and called it in a <logic> block:
>
> String table[][] = (String[][]) <xsp-request:get-attribute 
> name="mytable"/>;
>
> but Cocoon complains that I'm trying to cast a String to a 
> String[][] (indeed in the generated code I can see something 
> like String table[][] = (String[][]) 
> (String.valueOf(XSPRequestHelper.getAttribute(...))); ).
>   This probably a common newbie problem, but I haven't found 
> any useful solutions in the archives.
>
> Any suggestions? (Feel free to hit me on the head with a URL :-))
>
> Andre.


---------------------------------------------------------------------
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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to