cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carlos Maté" <>
Subject Re: Applet Servlet communication
Date Fri, 26 Jan 2007 08:34:02 GMT
I can return a string from cocoon but I have problems with special
characters. If I send á or ñ I receive ?
I`ve tried to specify <encoding>ISO-8859-1</encoding> in the text serializer
but It doesn't run.

Carlos Maté wrote:

My applet expects a string as an answer.

In the sitemap I want to call a function than calculates the string and send
this string to the applet. I don't want to serialize any xml document. And
if the function is a flowscript I don't know how to do it.


Hi Carlos,

returning a string from cocoon is no problem. This is what you could do in
your sitemap.xmap:

1. Create matcher for your request:

<map:match pattern="request-string.html">
  <map:call function="testfunction"/>

2. Create a flowscript function that does just does something with your request
and calls another pipeline that returns your calculated string:

function testfunction()
  var something = "test";
  cocoon.sendPage("returnstring.html", {something:something});

See: for more

3. Define the matcher that generates your string:

<map:match pattern="returnstring.html">
  <map:generate src="test.xml" type="jx"/>
  <map:serialize type="text" mime-type="text/plain"/>

In this case the test.xml is a jx template that should look something like:

<jx:template xmlns:jx="";>

I hope this helps you out.

Kind regards,

Jeroen Reijn

Hi Carlos, what does your applet expect as an answer? an XML document, a
string or something else?

I think the following two pages wil be of help for you:


Jeroen Reijn

Carlos Maté wrote:


    We hava an applet that needs some data. The applet ask for it using
    a URLConnection. And wait for the answer using


    Cocoon servlet matches this URL in the sitemap but How can I send de
    answer ?

    How do I write the sitemap?

View raw message