You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Michael Bierenfeld <mi...@atmiralis.de> on 2000/04/12 17:44:46 UTC

Input/Output. Partly solved.

Hello,

the following xml-file "login.xml" produces a html-form this is
submitted to itself with a
submit button.

	<form action="/Projekte/Voith/xml/login/login.xml" name="login">
	
		<row>
			<inputfield name="sUserName" datatype="String">
				Username : 
			</inputfield>

			<inputfield name="sUserPassword" datatype="String">
				Userpassword : 
			</inputfield>
		</row>
	
		<row>
			<submitbutton 
				image="/Projekte/Voith/html/Pictures/buttons/OK-25x60.gif"
				href="javascript:document.form.submit ()"/>
		</row>

	</form>

I have implemented the following xsp :

<xsl:template match="inputfield">

  <xsp:logic>

     InputField <xsl:value-of select="@name"/> = new InputField
           (<xsl:text>"</xsl:text><xsl:value-of
select="@name"/><xsl:text>"</xsl:text>,
            <xsl:text>"</xsl:text><xsl:value-of
select="@datatype"/><xsl:text>"</xsl:text>,
            request.getParameter (<xsl:text>"</xsl:text><xsl:value-of
select="@name"/>
            <xsl:text>"</xsl:text>));

  </xsp:logic>	

  <xsl:apply-templates select ="@*|node()"/>

  <input name="{@name}">
  </input>

</xsl:template>

So far so Good. This generates my a _login.java File containg the
follwing.

  InputField sUserName = new InputField ("sUserName", "String",
request.getParameter ("sUserName");
   InputField sUserPassword = new InputField ("sUserName", "String",
request.getParameter ("sUserPassword");

Thats not to bad. If the Form is submitted the request-values are stored
in the corresponding Java-Classes via
the constructor. But how to display this content in the mask (which is
the same!!) afterwards.

INPUTFIELD is translated into INPUT which is translated to HTML in the
following Stylesheet

<xsl:template match="input">

	<xsl:apply-templates/>
	<input name="{@name}" type="text"/>

</xsl:template>

I could think of the following

<input name="{@name}"
value="<xsp:expr>@{name}.fieldContent</xsp:expr>"/>.

But I guess I am totally on the wrong way here. It would be very
helpfull if somebody could give me a hint how to solve this trap.

Regards

Michael

Re: Input/Output. Partly solved.

Posted by Juan Jose Pablos <jj...@bton.ac.uk>.
Michael,

I am not sure if this is usefull for you:

<request:get-parameter name="sUserName"/>

<request:get-parameter name="sUserPassword"/>

have you tried this one?

I hope this helps.

Juan

----- Original Message -----
From: "Michael Bierenfeld" <mi...@atmiralis.de>
To: "Cocoon User Mailing List" <co...@xml.apache.org>
Sent: Wednesday, April 12, 2000 4:44 PM
Subject: Input/Output. Partly solved.


> Hello,
>
> the following xml-file "login.xml" produces a html-form this is
> submitted to itself with a
> submit button.
>
> <form action="/Projekte/Voith/xml/login/login.xml" name="login">
>
> <row>
> <inputfield name="sUserName" datatype="String">
> Username :
> </inputfield>
>
> <inputfield name="sUserPassword" datatype="String">
> Userpassword :
> </inputfield>
> </row>
>
> <row>
> <submitbutton
> image="/Projekte/Voith/html/Pictures/buttons/OK-25x60.gif"
> href="javascript:document.form.submit ()"/>
> </row>
>
> </form>
>
> I have implemented the following xsp :
>
> <xsl:template match="inputfield">
>
>   <xsp:logic>
>
>      InputField <xsl:value-of select="@name"/> = new InputField
>            (<xsl:text>"</xsl:text><xsl:value-of
> select="@name"/><xsl:text>"</xsl:text>,
>             <xsl:text>"</xsl:text><xsl:value-of
> select="@datatype"/><xsl:text>"</xsl:text>,
>             request.getParameter (<xsl:text>"</xsl:text><xsl:value-of
> select="@name"/>
>             <xsl:text>"</xsl:text>));
>
>   </xsp:logic>
>
>   <xsl:apply-templates select ="@*|node()"/>
>
>   <input name="{@name}">
>   </input>
>
> </xsl:template>
>
> So far so Good. This generates my a _login.java File containg the
> follwing.
>
>   InputField sUserName = new InputField ("sUserName", "String",
> request.getParameter ("sUserName");
>    InputField sUserPassword = new InputField ("sUserName", "String",
> request.getParameter ("sUserPassword");
>
> Thats not to bad. If the Form is submitted the request-values are stored
> in the corresponding Java-Classes via
> the constructor. But how to display this content in the mask (which is
> the same!!) afterwards.
>
> INPUTFIELD is translated into INPUT which is translated to HTML in the
> following Stylesheet
>
> <xsl:template match="input">
>
> <xsl:apply-templates/>
> <input name="{@name}" type="text"/>
>
> </xsl:template>
>
> I could think of the following
>
> <input name="{@name}"
> value="<xsp:expr>@{name}.fieldContent</xsp:expr>"/>.
>
> But I guess I am totally on the wrong way here. It would be very
> helpfull if somebody could give me a hint how to solve this trap.
>
> Regards
>
> Michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>