You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ben Munat <be...@munat.com> on 2003/08/16 20:23:35 UTC
request-param [was: basic form tutorial]
Still trying to get my simple post variables exercise to work. Came
across the Request Generator page in the docs. Do I need to put a
<map:generate type="request"/> in the pipeline for this page to get it
to find the post vars? There's gotta be some config thing missing.
Here's the form html for the first input:
<form method="post" action="songs" class="searchbox">
<input size="25" name="artist" type="text">
</form>
Here's the pipeline for the page:
<map:pipeline>
<map:match pattern="songs">
<map:generate type="file" src="content/songlist.xml"/>
<map:transform type="xslt" src="style/songlist.xsl">
<map:paramter name="artist"
value="{request-param:artist}"/>
<map:paramter name="title"
value="{request-param:title}"/>
<map:paramter name="style"
value="{request-param:style}"/>
</map:transform>
<map:serialize type="html"/>
</map:match>
</map:pipeline>
Here's the xconf line:
<component-instance
class="org.apache.cocoon.components.modules.input.RequestParameterModule"
logger="core.modules.input" name="request-param"/>
At the beginning of songlist.xsl, I have this:
<xsl:param name="artist"/> etc.
Then, in the root template I have a basic html framework and within the
body tags I have:
<p>Artist: <xsl:value-of select="$artist"/></p>
This all seems very straightforward and simple. But when I type
something in the artist form input box and hit submit, the page reloads
and there's still nothing after "Artist:".
What am I missing?
Ben
------------------------------------------------
Ben Munat wrote:
> Thanks guys. This sounds really easy. Unfortunately, I haven't been able
> to get it to work yet.
>
> I checked my cocoon.xconf file and the RequestParameterModule is just as
> the wiki page says it should be. I edited the map:transform element of
> the page's pipeline to include the parameters (<map:parameter
> name="artist" value="{request-param:artist}"/>). And I declared the
> parameters as top-level params and then tried to get their values (with
> <xsl:value-of select="$title"/> etc.). But when I put something into a
> form field and submit it, I get nuttin... the page reloads, but the
> variables are still empty.
>
> Might there be another configuration thing I'm missing? Or maybe I'm
> just not doing something really obvious... that's my specialty. Well, at
> least all the variable names are all lower case, and I checked
> thoroughly for typos! ;o)
>
> Other ideas appreciated.
>
> Ben
>
> Geoff Howard wrote:
>
>> Conal Tuohy wrote:
>>
>>> Ben, you can pass the form values to your XSLT something like this:
>>>
>>> <map:transform src="song-list-to-html.xsl">
>>> <map:parameter name="artist"
>>> value="{request-param:artist}"/>
>>> <map:parameter name="title"
>>> value="{request-param:title}"/>
>>> <map:parameter name="style"
>>> value="{request-param:style}"/>
>>> </map:transform>
>>>
>>> Check out the RequestParameterModule:
>>> http://wiki.cocoondev.org/Wiki.jsp?page=RequestParameterModule
>>
>>
>>
>> And to use them in your stylesheet you need to define those three
>> values as top-level xsl:param elements:
>>
>> <xsl:stylesheet version="1.0"
>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
>>
>> <xsl:param name="artist"/>
>> <xsl:param name="title"/>
>> <xsl:param name="style"/>
>>
>> ....
>>
>> This is the same way you'd access external params sent to a
>> transformation in standard xslt from the command line.
>>
>> For this simple case, don't get bogged down in the frameworks you
>> mentioned. When you start getting into more complex needs, they'll be
>> appropriate but they're not _necessary_ and will cloud the simplicity
>> of Cocoon while you're just getting started.
>>
>> Geoff
>>
>>>> Hello. I'm very new to Cocoon and certainly no xml/programming/web
>>>> wizard. I have an html page created by an xlst and served by cocoon.
>>>> The source xml file is a list of songs; the xslt converts the
>>>> songlist into a table and puts it on a page below a basic
>>>> header/navbar and a box with some form inputs ("artist" and "title"
>>>> text boxes and a "style" dropdown) for searching. Now the trick is
>>>> to get cocoon to reload the page -- after I've entered something in
>>>> these widgets and clicked submit -- and only display the entries
>>>> from the songlist that match this criteria.
>>>>
>>>> I've poked around the wiki and the docs and searched the mailing
>>>> list and, well, I'm more confused than ever. Often the material is
>>>> over my head, and oriented-towards doing something fancier than I
>>>> need; form validation, database interaction and the like.
>>>>
>>>> All I want to do is get the values of three post variables and fill
>>>> the table of song data accordingly. Do I turn my xml file into an
>>>> xsp and put java code in to interpret the post vars? Do I use some
>>>> other component for this (an action... or this woody thing I keep
>>>> hearing about)? Is there a tutorial out there that I've missed that
>>>> has very basic instructions on using form vars?
>>>>
>>>> Thanks,
>>>>
>>>> Ben
>>>>
>>>>
>>>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: request-param [was: basic form tutorial]
Posted by Geoff Howard <co...@leverageweb.com>.
Ben Munat wrote:
> ACK! FORGOT THE FRICKIN' "E" IN "PARAMETER"! That's classic. I actually
> checked every single place that I had typed "artist", "style" and
> "title" about ten times, but of course I mistyped parameter! Can't
> believe I missed that. How embarrassing.
>
> Thanks very much.
>
> b
Been there, done that. Glad I could help.
Geoff
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re[2]: request-param [was: basic form tutorial]
Posted by "g[R]eK" <gR...@warsztat.pac.pl>.
<. Hi Ben! .>
Sunday, August 17, 2003, 7:46:31 AM, you wrote:
BM> ACK! FORGOT THE FRICKIN' "E" IN "PARAMETER"! That's classic. I actually
BM> checked every single place that I had typed "artist", "style" and
BM> "title" about ten times, but of course I mistyped parameter! Can't
BM> believe I missed that. How embarrassing.
BM> Thanks very much.
In Cocoon 2.1 is schema for sitemap, just search for "*.xsd" files and find it.
I think it will be very helpful.
--
Best regards
<. g[R]eK mailto:gReK@warsztat.pac.pl .>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: request-param [was: basic form tutorial]
Posted by Ben Munat <be...@munat.com>.
ACK! FORGOT THE FRICKIN' "E" IN "PARAMETER"! That's classic. I actually
checked every single place that I had typed "artist", "style" and
"title" about ten times, but of course I mistyped parameter! Can't
believe I missed that. How embarrassing.
Thanks very much.
b
Geoff Howard wrote:
> Ben, everything looks fine. You absolutely do not need RequestGenerator
> in this case. Is your pipeline snippet cut and paste? See below...
>
> Ben Munat wrote:
>
>> Still trying to get my simple post variables exercise to work. Came
>> across the Request Generator page in the docs. Do I need to put a
>> <map:generate type="request"/> in the pipeline for this page to get it
>> to find the post vars? There's gotta be some config thing missing.
>>
>> Here's the form html for the first input:
>>
>> <form method="post" action="songs" class="searchbox">
>> <input size="25" name="artist" type="text">
>> </form>
>>
>> Here's the pipeline for the page:
>>
>> <map:pipeline>
>> <map:match pattern="songs">
>> <map:generate type="file" src="content/songlist.xml"/>
>> <map:transform type="xslt" src="style/songlist.xsl">
>> <map:paramter name="artist"
>
>
> Typo: must be map:parameter not map:paramter. If that's it, make sure
> you change all three.
>
>> value="{request-param:artist}"/>
>> <map:paramter name="title"
>> value="{request-param:title}"/>
>> <map:paramter name="style"
>> value="{request-param:style}"/>
>> </map:transform>
>> <map:serialize type="html"/>
>> </map:match>
>> </map:pipeline>
>>
>> Here's the xconf line:
>>
>> <component-instance
>> class="org.apache.cocoon.components.modules.input.RequestParameterModule"
>> logger="core.modules.input" name="request-param"/>
>>
>> At the beginning of songlist.xsl, I have this:
>>
>> <xsl:param name="artist"/> etc.
>>
>> Then, in the root template I have a basic html framework and within
>> the body tags I have:
>>
>> <p>Artist: <xsl:value-of select="$artist"/></p>
>>
>> This all seems very straightforward and simple. But when I type
>> something in the artist form input box and hit submit, the page
>> reloads and there's still nothing after "Artist:".
>>
>> What am I missing?
>>
>> Ben
>>
>>
>> ------------------------------------------------
>> Ben Munat wrote:
>>
>>> Thanks guys. This sounds really easy. Unfortunately, I haven't been
>>> able to get it to work yet.
>>>
>>> I checked my cocoon.xconf file and the RequestParameterModule is just
>>> as the wiki page says it should be. I edited the map:transform
>>> element of the page's pipeline to include the parameters
>>> (<map:parameter name="artist" value="{request-param:artist}"/>). And
>>> I declared the parameters as top-level params and then tried to get
>>> their values (with <xsl:value-of select="$title"/> etc.). But when I
>>> put something into a form field and submit it, I get nuttin... the
>>> page reloads, but the variables are still empty.
>>>
>>> Might there be another configuration thing I'm missing? Or maybe I'm
>>> just not doing something really obvious... that's my specialty. Well,
>>> at least all the variable names are all lower case, and I checked
>>> thoroughly for typos! ;o)
>>>
>>> Other ideas appreciated.
>>>
>>> Ben
>>>
>>> Geoff Howard wrote:
>>>
>>>> Conal Tuohy wrote:
>>>>
>>>>> Ben, you can pass the form values to your XSLT something like this:
>>>>>
>>>>> <map:transform src="song-list-to-html.xsl">
>>>>> <map:parameter name="artist"
>>>>> value="{request-param:artist}"/>
>>>>> <map:parameter name="title"
>>>>> value="{request-param:title}"/>
>>>>> <map:parameter name="style"
>>>>> value="{request-param:style}"/>
>>>>> </map:transform>
>>>>>
>>>>> Check out the RequestParameterModule:
>>>>> http://wiki.cocoondev.org/Wiki.jsp?page=RequestParameterModule
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> And to use them in your stylesheet you need to define those three
>>>> values as top-level xsl:param elements:
>>>>
>>>> <xsl:stylesheet version="1.0"
>>>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
>>>>
>>>> <xsl:param name="artist"/>
>>>> <xsl:param name="title"/>
>>>> <xsl:param name="style"/>
>>>>
>>>> ....
>>>>
>>>> This is the same way you'd access external params sent to a
>>>> transformation in standard xslt from the command line.
>>>>
>>>> For this simple case, don't get bogged down in the frameworks you
>>>> mentioned. When you start getting into more complex needs, they'll
>>>> be appropriate but they're not _necessary_ and will cloud the
>>>> simplicity of Cocoon while you're just getting started.
>>>>
>>>> Geoff
>>>>
>>>>>> Hello. I'm very new to Cocoon and certainly no xml/programming/web
>>>>>> wizard. I have an html page created by an xlst and served by
>>>>>> cocoon. The source xml file is a list of songs; the xslt converts
>>>>>> the songlist into a table and puts it on a page below a basic
>>>>>> header/navbar and a box with some form inputs ("artist" and
>>>>>> "title" text boxes and a "style" dropdown) for searching. Now the
>>>>>> trick is to get cocoon to reload the page -- after I've entered
>>>>>> something in these widgets and clicked submit -- and only display
>>>>>> the entries from the songlist that match this criteria.
>>>>>>
>>>>>> I've poked around the wiki and the docs and searched the mailing
>>>>>> list and, well, I'm more confused than ever. Often the material is
>>>>>> over my head, and oriented-towards doing something fancier than I
>>>>>> need; form validation, database interaction and the like.
>>>>>>
>>>>>> All I want to do is get the values of three post variables and
>>>>>> fill the table of song data accordingly. Do I turn my xml file
>>>>>> into an xsp and put java code in to interpret the post vars? Do I
>>>>>> use some other component for this (an action... or this woody
>>>>>> thing I keep hearing about)? Is there a tutorial out there that
>>>>>> I've missed that has very basic instructions on using form vars?
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Ben
>>>>>>
>>>>>>
>>>>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: request-param [was: basic form tutorial]
Posted by Geoff Howard <co...@leverageweb.com>.
Ben, everything looks fine. You absolutely do not need RequestGenerator
in this case. Is your pipeline snippet cut and paste? See below...
Ben Munat wrote:
> Still trying to get my simple post variables exercise to work. Came
> across the Request Generator page in the docs. Do I need to put a
> <map:generate type="request"/> in the pipeline for this page to get it
> to find the post vars? There's gotta be some config thing missing.
>
> Here's the form html for the first input:
>
> <form method="post" action="songs" class="searchbox">
> <input size="25" name="artist" type="text">
> </form>
>
> Here's the pipeline for the page:
>
> <map:pipeline>
> <map:match pattern="songs">
> <map:generate type="file" src="content/songlist.xml"/>
> <map:transform type="xslt" src="style/songlist.xsl">
> <map:paramter name="artist"
Typo: must be map:parameter not map:paramter. If that's it, make sure
you change all three.
> value="{request-param:artist}"/>
> <map:paramter name="title"
> value="{request-param:title}"/>
> <map:paramter name="style"
> value="{request-param:style}"/>
> </map:transform>
> <map:serialize type="html"/>
> </map:match>
> </map:pipeline>
>
> Here's the xconf line:
>
> <component-instance
> class="org.apache.cocoon.components.modules.input.RequestParameterModule"
> logger="core.modules.input" name="request-param"/>
>
> At the beginning of songlist.xsl, I have this:
>
> <xsl:param name="artist"/> etc.
>
> Then, in the root template I have a basic html framework and within the
> body tags I have:
>
> <p>Artist: <xsl:value-of select="$artist"/></p>
>
> This all seems very straightforward and simple. But when I type
> something in the artist form input box and hit submit, the page reloads
> and there's still nothing after "Artist:".
>
> What am I missing?
>
> Ben
>
>
> ------------------------------------------------
> Ben Munat wrote:
>
>> Thanks guys. This sounds really easy. Unfortunately, I haven't been
>> able to get it to work yet.
>>
>> I checked my cocoon.xconf file and the RequestParameterModule is just
>> as the wiki page says it should be. I edited the map:transform element
>> of the page's pipeline to include the parameters (<map:parameter
>> name="artist" value="{request-param:artist}"/>). And I declared the
>> parameters as top-level params and then tried to get their values
>> (with <xsl:value-of select="$title"/> etc.). But when I put something
>> into a form field and submit it, I get nuttin... the page reloads, but
>> the variables are still empty.
>>
>> Might there be another configuration thing I'm missing? Or maybe I'm
>> just not doing something really obvious... that's my specialty. Well,
>> at least all the variable names are all lower case, and I checked
>> thoroughly for typos! ;o)
>>
>> Other ideas appreciated.
>>
>> Ben
>>
>> Geoff Howard wrote:
>>
>>> Conal Tuohy wrote:
>>>
>>>> Ben, you can pass the form values to your XSLT something like this:
>>>>
>>>> <map:transform src="song-list-to-html.xsl">
>>>> <map:parameter name="artist"
>>>> value="{request-param:artist}"/>
>>>> <map:parameter name="title"
>>>> value="{request-param:title}"/>
>>>> <map:parameter name="style"
>>>> value="{request-param:style}"/>
>>>> </map:transform>
>>>>
>>>> Check out the RequestParameterModule:
>>>> http://wiki.cocoondev.org/Wiki.jsp?page=RequestParameterModule
>>>
>>>
>>>
>>>
>>> And to use them in your stylesheet you need to define those three
>>> values as top-level xsl:param elements:
>>>
>>> <xsl:stylesheet version="1.0"
>>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
>>>
>>> <xsl:param name="artist"/>
>>> <xsl:param name="title"/>
>>> <xsl:param name="style"/>
>>>
>>> ....
>>>
>>> This is the same way you'd access external params sent to a
>>> transformation in standard xslt from the command line.
>>>
>>> For this simple case, don't get bogged down in the frameworks you
>>> mentioned. When you start getting into more complex needs, they'll
>>> be appropriate but they're not _necessary_ and will cloud the
>>> simplicity of Cocoon while you're just getting started.
>>>
>>> Geoff
>>>
>>>>> Hello. I'm very new to Cocoon and certainly no xml/programming/web
>>>>> wizard. I have an html page created by an xlst and served by
>>>>> cocoon. The source xml file is a list of songs; the xslt converts
>>>>> the songlist into a table and puts it on a page below a basic
>>>>> header/navbar and a box with some form inputs ("artist" and "title"
>>>>> text boxes and a "style" dropdown) for searching. Now the trick is
>>>>> to get cocoon to reload the page -- after I've entered something in
>>>>> these widgets and clicked submit -- and only display the entries
>>>>> from the songlist that match this criteria.
>>>>>
>>>>> I've poked around the wiki and the docs and searched the mailing
>>>>> list and, well, I'm more confused than ever. Often the material is
>>>>> over my head, and oriented-towards doing something fancier than I
>>>>> need; form validation, database interaction and the like.
>>>>>
>>>>> All I want to do is get the values of three post variables and fill
>>>>> the table of song data accordingly. Do I turn my xml file into an
>>>>> xsp and put java code in to interpret the post vars? Do I use some
>>>>> other component for this (an action... or this woody thing I keep
>>>>> hearing about)? Is there a tutorial out there that I've missed that
>>>>> has very basic instructions on using form vars?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Ben
>>>>>
>>>>>
>>>>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: request-param [was: basic form tutorial]
Posted by "g[R]eK" <gR...@warsztat.pac.pl>.
<. Hi Ben! .>
Saturday, August 16, 2003, 8:23:35 PM, you wrote:
BM> Still trying to get my simple post variables exercise to work. Came
BM> across the Request Generator page in the docs. Do I need to put a
BM> <map:generate type="request"/> in the pipeline for this page to get it
BM> to find the post vars? There's gotta be some config thing missing.
BM> Here's the form html for the first input:
BM> <form method="post" action="songs" class="searchbox">
BM> <input size="25" name="artist" type="text">
BM> </form>
Did you try get method?
And what about logs (like core.log)?
--
Best regards
<. g[R]eK mailto:gReK@warsztat.pac.pl .>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org