You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Skladovs, Victor" <Sk...@his.de> on 2002/11/07 09:56:29 UTC

Problem: Pass parameters from applet to cocoon

Dear Friends!

I would be grateful if you help me to solve the following problem:
My goal is to pass the parameters from an applet to cocoon with POST
method and receive a HTML Page back. I haven't managed to get this so
far :-(

What I've done:
	1)	In my applet:

	URL url = new URL("http://myserver.de/cocoon/page.html");
        	URLConnection connection = url.openConnection();
        	connection.setDoOutput(true);
        	connection.setRequestProperty("Content-Type",
"text/html");
        	PrintWriter out = new
PrintWriter(connection.getOutputStream());
        	out.print("user=" + URLEncoder.encode("user") + "&");
        	out.print("password=" + URLEncoder.encode("password"));
        	out.close();

This is of course only a example: if it was only for these two
parameters, I would pass them with GET method:
applet.getAppletContext().showDocument(
"http://myserver.de/cocoon/page.html?user=user&password=password");

It works perfect. But actually I'd like to pass to cocoon a vector with
parameters.

	2)	In my sitemap.xmap :

			<map:match pattern="page.html">
				<map:generate
src="docs/samples/xsp/page.xsp" type="serverpages"/>
				<map:transform
src="stylesheets/xml2html.xsl">
					<map:parameter
name="view-source" value=" docs/samples/xsp/page.xsp"/>
				</map:transform>
				<map:serialize/>
			</map:match>


3)my page.xsp:

<xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
xmlns:xsp-request="http://apache.org/xsp/request/2.0"
xmlns:esql="http://apache.org/cocoon/SQL/v2">
	<page title="My HTML Page" bgcolor="#FFFFC0">
		<table>
			<tr>
				<td>
					<p align="left">
	
<xsp-request:get-parameter name="user"/>
					</p>
					<p align="left">
	
<xsp-request:get-parameter name="password"/>
					</p>
				</td>
			</tr>
		</table>
	</page>
</xsp:page>



	4) Again in applet :

		If I open BefferedReader, I can see that cocoon has done
his job - the HTML page exists, I can read it as a String in my
Java-Console , but I don't see it in my browser!!!

           BufferedReader in = new BufferedReader(new
InputStreamReader(connection.getInputStream()));
    		String line;
            while((line = in.readLine()) != null){
                System.out.println(line);
            }
            in.close();

	QUESTION: What have I done wrong? What do I have to do to get my
HTML Page be seen in browser?

	Thanks to all in advance!

	Viktor




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

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